Chapter 8. Yum
yumto install, update or remove packages on your system. All examples in this chapter assume that you have already obtained superuser privileges by using either the
8.1. Checking For and Updating Packages
8.1.1. Checking For Updates
yum check-updateLoaded plugins: product-id, refresh-packagekit, subscription-manager Updating Red Hat repositories. INFO:rhsm-app.repolib:repos updated: 0 PackageKit.x86_64 0.5.8-2.el6 rhel PackageKit-glib.x86_64 0.5.8-2.el6 rhel PackageKit-yum.x86_64 0.5.8-2.el6 rhel PackageKit-yum-plugin.x86_64 0.5.8-2.el6 rhel glibc.x86_64 2.11.90-20.el6 rhel glibc-common.x86_64 2.10.90-22 rhel kernel.x86_64 2.6.31-14.el6 rhel kernel-firmware.noarch 2.6.31-14.el6 rhel rpm.x86_64 4.7.1-5.el6 rhel rpm-libs.x86_64 4.7.1-5.el6 rhel rpm-python.x86_64 4.7.1-5.el6 rhel udev.x86_64 147-2.15.el6 rhel yum.noarch 3.2.24-4.el6 rhel
PackageKit— the name of the package
x86_64— the CPU architecture the package was built for
0.5.8— the version of the updated package to be installed
rhel— the repository in which the updated package is located
8.1.2. Updating Packages
Updating a Single Package
yum update udevLoaded plugins: product-id, refresh-packagekit, subscription-manager Updating Red Hat repositories. INFO:rhsm-app.repolib:repos updated: 0 Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package udev.x86_64 0:147-2.15.el6 set to be updated --> Finished Dependency Resolution Dependencies Resolved =========================================================================== Package Arch Version Repository Size =========================================================================== Updating: udev x86_64 147-2.15.el6 rhel 337 k Transaction Summary =========================================================================== Install 0 Package(s) Upgrade 1 Package(s) Total download size: 337 k Is this ok [y/N]:
udev.x86_64— you can download and install new udev package.
yumpresents the update information and then prompts you as to whether you want it to perform the update;
yumruns 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
yumasks (in which case it runs non-interactively). However, you should always examine which changes
yumplans to make to the system so that you can easily troubleshoot any problems that might arise.If a transaction does go awry, you can view Yum's transaction history by using the
yum historycommand as described in Section 8.3, “Working with Transaction History”.
yumalways installs a new kernel in the same sense that RPM installs a new kernel when you use the command
rpm -i kernel. Therefore, you do not need to worry about the distinction between installing and upgrading a kernel package when you use
yum: it will do the right thing, regardless of whether you are using the
rpm -i kernelcommand (which installs a new kernel) instead of
rpm -u kernel(which replaces the current kernel). See Section B.2.2, “Installing and Upgrading” for more information on installing/upgrading kernels with RPM.
Updating All Packages and Their Dependencies
yum update(without any arguments):
Updating Security-Related Packages
yumcommand with a set of highly-useful security-centric commands, subcommands and options. See Section 8.5.3, “Plug-in Descriptions” for specific information.
Updating Packages Automatically
crondaemon and downloads metadata from your package repositories. With the yum-cron service enabled, the user can schedule an automated daily Yum update as a cron job.
yum install yum-cron
chkconfig yum-cron on
service yum-cron start
service yum-cron status
yum-croncan be found in the comments within
/etc/sysconfig/yum-cronand at the yum-cron(8) manual page.
8.1.3. Preserving Configuration File Changes
8.1.4. 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 6 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 rhel6.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 8.1. Upgrading from Red Hat Enterprise Linux 6.3 to 6.4
RHEL6.4-Server-20130130.0-x86_64-DVD1.iso. A target directory created for mounting is
root, change into the directory with your ISO image and type:
media.repofile from the mount directory:
/etc/yum.repos.d/rhel6.repocopied in the previous step: