Bookmark this page

RPM Software Packages and Yum

RPM packages, grouped into yum repositories, provide a uniform method of tracking software installation and updates.

Objectives

After completing this section, students should be able to explain what an RPM package is and how RPM packages are used to manage software on a Red Hat Enterprise Linux system.

Software packages and RPM

Many years ago, Red Hat developed the RPM Package Manager, which provides a standard way to package software for distribution. Managing software in the form of RPM packages is much simpler than working with software that has simply been extracted into a file system from an archive. It lets administrators track which files were installed by the software package and which ones need to be removed if it is uninstalled, and check to ensure supporting packages are present when it is installed. Information about installed packages is stored in a local RPM database on each system. All software provided by Red Hat for Red Hat Enterprise Linux is provided as an RPM package.

RPM package files are named using a combination of the package name-version-release.architecture:

            ┌───────────────────────── NAME
            │        ┌──────────────── VERSION  
            │        │     ┌────────── RELEASE
            │        │     │      ┌─── ARCH
       ┌────┴────┐ ┌─┴─┐ ┌─┴─┐ ┌──┴─┐
       httpd-tools-2.4.6-7.el7.x86_64.rpm

  • NAME is one or more words describing the contents (httpd-tools).

  • VERSION is the version number of the original software (2.4.6).

  • RELEASE is the release number of the package based on that version, and is set by the packager, who might not be the original software developer (7.el7).

  • ARCH is the processor architecture the package was compiled to run on. "noarch" indicates that this package's contents are not architecture-specific (x86_64).

When installing packages from repositories, only the package name is required. The package with the higher version will be installed. If there are multiple files with the same version, the package with the higher release number will be installed.

Each RPM package is a special archive made up of three components:

  • The files installed by the package.

  • Information about the package (metadata), such as the name/version/release/arch; a summary and description of the package; whether it requires other packages to be installed; licensing; a package changelog; and other details.

  • Scripts which may run when this package is installed, updated, or removed, or which are triggered when other packages are installed, updated, or removed.

RPM packages can be digitally signed by the organization that packaged them. All packages from a particular source are normally signed by the same GPG private key. If the package is altered or corrupted, the signature will no longer be valid. This allows the system to verify package integrity before installing them. All RPM packages released by Red Hat are digitally signed.

Updates and Patches

When the upstream source code for a software package is patched by Red Hat, a complete RPM package is generated. If a package is newly added to a system, only the latest version of that package is needed, not every version of the package since the first release. For systems that need updating, the old version of the package is actually removed and the new version is installed. Configuration files are usually retained during an upgrade, but the exact behavior for a particular package is defined when the new version of the package is created.

In most cases, only one version or release of a package may be installed at a time. Typically, the RPM installation process will not allow files to be overwritten. If a package is built so that there are no conflicting filenames, then multiple versions may be installed. This is the case for the kernel package. Since a new kernel can only be tested by booting to that kernel, the package is specifically designed so that multiple versions may be installed at once. If the new kernel fails to boot, the old kernel is still available.

The yum package manager

Once a system is installed, additional software packages and updates are normally installed from a network package repository, most frequently through the Red Hat subscription management service discussed in the previous section. The rpm command may be used to install, update, remove, and query RPM packages. However, it does not resolve dependencies automatically and all packages must be listed. Tools such as PackageKit and yum are front-end applications for rpm and can be used to install individual packages or package collections (sometimes called package groups).

The yum command searches numerous repositories for packages and their dependencies so they may be installed together in an effort to alleviate dependency issues. The main configuration file for yum is /etc/yum.conf with additional repository configuration files located in the /etc/yum.repos.d directory. Repository configuration files include, at a minimum, a repo id (in square brackets), a name and the URL location of the package repository. The URL can point to a local directory (file) or remote network share (http, ftp, etc.). If the URL is pasted in a browser, the contents should display the RPM packages, possibly in one or more subdirectories, and a repodata directory with information about available packages.

The yum command is used to list repositories, packages, and package groups:

[root@serverX ~]# yum repolist
Loaded plugins: langpacks
repo id                    repo name                                      status
!rhel_dvd                  Remote classroom copy of dvd                   4,529
repolist: 4,529
[root@serverX ~]# yum list yum*
Loaded plugins: langpacks
Installed Packages
yum.noarch                              3.4.3-118.2.el7            @anaconda/7.0
yum-langpacks.noarch                    0.4.2-3.el7                @rhel_dvd    
yum-metadata-parser.x86_64              1.1.4-10.el7               @anaconda/7.0
yum-rhn-plugin.noarch                   2.0.1-4.el7                @rhel_dvd    
yum-utils.noarch                        1.1.31-24.el7              @rhel_dvd    
Available Packages
yum-plugin-aliases.noarch               1.1.31-24.el7              rhel_dvd     
yum-plugin-changelog.noarch             1.1.31-24.el7              rhel_dvd     
yum-plugin-tmprepo.noarch               1.1.31-24.el7              rhel_dvd     
yum-plugin-verify.noarch                1.1.31-24.el7              rhel_dvd     
yum-plugin-versionlock.noarch           1.1.31-24.el7              rhel_dvd    
[root@serverX ~]# yum list installed
Loaded plugins: langpacks
Installed Packages
GConf2.x86_64                          3.2.6-8.el7                 @rhel_dvd    
ModemManager.x86_64                    1.1.0-6.git20130913.el7     @rhel_dvd    
ModemManager-glib.x86_64               1.1.0-6.git20130913.el7     @rhel_dvd    
...
[root@serverX ~]# yum grouplist
...
Installed groups:
   Base
   Desktop Debugging and Performance Tools
   Dial-up Networking Support
   Fonts
   Input Methods
...

References

yum(8), yum.conf(5), rpm(8), rpm2cpio(8), and rpmkeys(8) man pages

Revision: rh124-7-1b00421