Chapter 9. Yum
9.1. Checking For and Updating Packages
9.1.1. Checking For Updates
Example 9.1. Example output of the yum check-update command
check-updatecan look as follows:
yum check-updateLoaded plugins: product-id, search-disabled-repos, subscription-manager dracut.x86_64 033-360.el7_2 rhel-7-server-rpms dracut-config-rescue.x86_64 033-360.el7_2 rhel-7-server-rpms kernel.x86_64 3.10.0-327.el7 rhel-7-server-rpms rpm.x86_64 4.11.3-17.el7 rhel-7-server-rpms rpm-libs.x86_64 4.11.3-17.el7 rhel-7-server-rpms rpm-python.x86_64 4.11.3-17.el7 rhel-7-server-rpms yum.noarch 3.4.3-132.el7 rhel-7-server-rpms
dracut— the name of the package,
x86_64— the CPU architecture the package was built for,
033— the version of the updated package to be installed,
360.el7— the release of the updated package,
_2— a build version, added as part of a z-stream update,
rhel-7-server-rpms— the repository in which the updated package is located.
9.1.2. Updating Packages
Updating a Single Package
Example 9.2. Updating the rpm package
yum update rpmLoaded plugins: langpacks, product-id, subscription-manager Updating Red Hat repositories. INFO:rhsm-app.repolib:repos updated: 0 Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package rpm.x86_64 0:4.11.1-3.el7 will be updated --> Processing Dependency: rpm = 4.11.1-3.el7 for package: rpm-libs-4.11.1-3.el7.x86_64 --> Processing Dependency: rpm = 4.11.1-3.el7 for package: rpm-python-4.11.1-3.el7.x86_64 --> Processing Dependency: rpm = 4.11.1-3.el7 for package: rpm-build-4.11.1-3.el7.x86_64 ---> Package rpm.x86_64 0:4.11.2-2.el7 will be an update --> Running transaction check ... --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Updating: rpm x86_64 4.11.2-2.el7 rhel 1.1 M Updating for dependencies: rpm-build x86_64 4.11.2-2.el7 rhel 139 k rpm-build-libs x86_64 4.11.2-2.el7 rhel 98 k rpm-libs x86_64 4.11.2-2.el7 rhel 261 k rpm-python x86_64 4.11.2-2.el7 rhel 74 k Transaction Summary ============================================================================= Upgrade 1 Package (+4 Dependent packages) Total size: 1.7 M Is this ok [y/d/N]:
rpm.x86_64— you can download and install a new rpm package as well as its dependencies. Transaction check is performed for each of these packages.
- Yum presents the update information and then prompts you for confirmation of the update; yum runs interactively by default. If you already know which transactions the
yumcommand plans to perform, you can use the
-yoption to automatically answer
yesto any questions that yum asks (in which case it runs non-interactively). However, you should always examine which changes yum plans to make to the system so that you can easily troubleshoot any problems that might arise. You can also choose to download the package without installing it. To do so, select the
doption at the download prompt. This launches a background download of the selected package.If a transaction fails, you can view yum transaction history by using the
yum historycommand as described in Section 9.4, “Working with Transaction History”.
rpm -i kernelcommand which installs a new kernel instead of
rpm -u kernelwhich replaces the current kernel.
yum group updategroup_name
upgradecommand that is equal to
obsoletesconfiguration option (see Section 9.5.1, “Setting [main] Options”). By default,
obsoletesis turned on in
/etc/yum.conf, which makes these two commands equivalent.
Updating All Packages and Their Dependencies
yum updatecommand without any arguments:
Updating Security-Related Packages
yum update --security
yum update-minimal --security
- the kernel-3.10.0-1 package is installed on your system;
- the kernel-3.10.0-2 package was released as a security update;
- the kernel-3.10.0-3 package was released as a bug fix update.
yum update-minimal --securityupdates the package to kernel-3.10.0-2, and
yum update --securityupdates the package to kernel-3.10.0-3.
9.1.3. Upgrading the System Off-line with ISO and Yum
yum updatecommand with the Red Hat Enterprise Linux installation ISO image is an easy and quick way to upgrade systems to the latest minor version. The following steps illustrate the upgrading process:
- Create a target directory to mount your ISO image. This directory is not automatically created when mounting, so create it before proceeding to the next step. As
mkdirmount_dirReplace mount_dir with a path to the mount directory. Typically, users create it as a subdirectory in the
- Mount the Red Hat Enterprise Linux 7 installation ISO image to the previously created target directory. As
loopiso_name mount_dirReplace iso_name with a path to your ISO image and mount_dir with a path to the target directory. Here, the
loopoption is required to mount the file as a block device.
- Copy the
media.repofile from the mount directory to the
/etc/yum.repos.d/directory. Note that configuration files in this directory must have the .repo extension to function properly.
/etc/yum.repos.d/new.repoThis creates a configuration file for the yum repository. Replace new.repo with the filename, for example rhel7.repo.
- Edit the new configuration file so that it points to the Red Hat Enterprise Linux installation ISO. Add the following line into the
baseurl=file:///mount_dirReplace mount_dir with a path to the mount point.
- Update all yum repositories including
/etc/yum.repos.d/new.repocreated in previous steps. As
updateThis upgrades your system to the version provided by the mounted ISO image.
- After successful upgrade, you can unmount the ISO image. As
umountmount_dirwhere mount_dir is a path to your mount directory. Also, you can remove the mount directory created in the first step. As
- If you will not use the previously created configuration file for another installation or update, you can remove it. As
Example 9.3. Upgrading from Red Hat Enterprise Linux 7.0 to 7.1
rhel-server-7.1-x86_64-dvd.iso, create a target directory for mounting, such as
root, change into the directory with your ISO image and type:
media.repofile from the mount directory:
/etc/yum.repos.d/rhel7.repocopied in the previous step: