Top Button Left Second Button Left Third Button Left Fourth Button Left Fifth Button Left Sixth Button left Seventh Button left Eight Button Left

Managing Packages With Yum


There are numerous package managers available for Linux systems. Several of the package managers offer graphical front-ends, contain search capabilities, allow updates to be installed from remote locations, and provide E-mail notifications when new packages are available. One package manager that provides all of these capabilities is YUM (YellowDog Updater Modified). This article will provide an introduction to package management with yum, and will show how a server that uses yum can be configured to generate E-mail notification when new packages are available for a server.

Configuring yum


Yum reads its configuration from one or more configuration files. The main configuration file is typically stored in /etc/yum.conf, and contains the default settings to use when retrieving and intalling packages. A sample configuration file from a CentOS 4.0 server is shown below:

$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=centos-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

In addition to the main yum.conf configuration file which is described in the yum.conf manual page, yum will look for remote repository definitions in the directory /etc/yum.repos.d. A sample repository definition from a CentOS 4.0 server is included below:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

Each repository definition starts with a descriptive name that is enclosed in brackets. Inside each repository definition stanza is a line with a descriptive name, a flag to indicate if GPG signatures should be checked, and the locations to retrieve updates and the GPG keys that are used to sign the updates. Variables can be be used in URLs, and in the example above the $releasever and $basearch variables are used to reference the Operating System release and the file system base where updates are located.

Viewing yum options


The yum script comes with several options to control the package management process. These options can be viewed by invoking yum with the "-h" (help) option:

$ yum -h

usage: yum [options] < update | install | info | remove | list |
    clean | provides | search | check-update | groupinstall |
    groupupdate | grouplist | groupinfo | groupremove |
    makecache | localinstall | erase | upgrade | whatprovides |
    localupdate | resolvedep | shell | deplist >

options:
  -h, help            show this help message and exit
  -t, tolerant        be tolerant of errors
  -C                    run entirely from cache, dont update cache
  -c  [config file]     config file location
  -R  [minutes]         maximum command wait time
  -d  [debug level]     debugging output level
  -e  [error level]     error output level
  -y                    answer yes for all questions
  version             show Yum version and exit
  installroot=[path]  set install root
  enablerepo=[repo]   enable one or more repositories (wildcards allowed)
  disablerepo=[repo]  disable one or more repositories (wildcards allowed)
  exclude=[package]   exclude package(s) by name or glob
  obsoletes           enable obsoletes processing during updates
  noplugins           disable Yum plugins

The following sections will describe several of these options.

Listing installed packages


Before you can update packages on a system, it is first useful to see which packages are installed. Yum contains a "list" option to display the list of installed packages. When invoked without arguments, list will show all packages installed:

$ yum list |more

Setting up Repos
Reading repository metadata in from local files
Installed Packages
4Suite.i386                              1.0-3                  installed
GConf2.i386                              2.8.1-1                installed
GConf2-devel.i386                        2.8.1-1                installed
HelixPlayer.i386                         1:1.0.6-0.fc3.1        installed
ImageMagick.i386                         6.2.2.0-2.fc3          installed
MAKEDEV.i386                             3.13-1                 installed
Maelstrom.i386                           3.0.6-6                installed
NetworkManager.i386                      0.3.4-1.1.0.fc3        installed
NetworkManager-gnome.i386                0.3.4-1.1.0.fc3        installed

If a string is passed as an argument to the list option, yum will look for all packages that match that string. The following example will list all packages with the name "curl":

$ yum list curl

Setting up repositories
rawhide-updates           100% |=========================| 1.1 kB    00:00
updates                   100% |=========================| 1.1 kB    00:00
testing-updates           100% |=========================|  951 B    00:00
Reading repository metadata in from local files
Available Packages
curl.i386                                7.15.0-1               rawhide-updates 

Getting package descriptions


The previous example showed the version of the installed curl package, and listed the repository the package was part of (in this case, rawhide-updates). It is somtimes useful to get a description of what a package is. This can be accomplished by passing a package name to the yum "info" option:

$ yum info curl

Setting up repositories
rawhide-updates           100% |=========================| 1.1 kB    00:00
updates                   100% |=========================| 1.1 kB    00:00
testing-updates           100% |=========================|  951 B    00:00
Reading repository metadata in from local files
Available Packages
Name   : curl
Arch   : i386
Version: 7.15.0
Release: 1
Size   : 253 k
Repo   : rawhide-updates
Summary: A utility for getting files from remote servers (FTP, HTTP, and others).
Description:
cURL is a tool for getting files from FTP, HTTP, Gopher, Telnet, and
Dict servers, using any of the supported protocols. cURL is designed
to work without user interaction or any kind of interactivity. cURL
offers many useful capabilities, like proxy support, user
authentication, FTP upload, HTTP post, and file transfer resume.

The output from the info option displays the package details, the size of the package, and a detailed description of what the package can be used for.

Searching for packages


One of yum's most powerful options is its search capabilities. Yum allows you to query packages by keyword, package name and pathname. The following example uses the curl "search" option to locate all packages that contain the string "curl" in their name:

$ yum search curl

Searching Packages:
Setting up repositories
updates-released          100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 977 kB    00:01
extras    : ################################################## 2714/2714
Added 8 new packages, deleted 0 old in 6.47 seconds

curl.i386                                7.13.1-3               base
Matched from:
curl
cURL is a tool for getting files from FTP, HTTP, Gopher, Telnet, and
Dict servers, using any of the supported protocols. cURL is designed
to work without user interaction or any kind of interactivity. cURL
offers many useful capabilities, like proxy support, user
authentication, FTP upload, HTTP post, and file transfer resume.
http://curl.haxx.se/

curl-devel.i386                          7.13.1-3               base
Matched from:
curl-devel
Files needed for building applications with libcurl.
cURL is a tool for getting files from FTP, HTTP, Gopher, Telnet, and
Dict servers, using any of the supported protocols. The curl-devel
package includes files needed for developing applications which can
use cURL's capabilities internally.
http://curl.haxx.se/

curl.i386                                7.13.1-3               installed
Matched from:
curl
cURL is a tool for getting files from FTP, HTTP, Gopher, Telnet, and
Dict servers, using any of the supported protocols. cURL is designed
to work without user interaction or any kind of interactivity. cURL
offers many useful capabilities, like proxy support, user
authentication, FTP upload, HTTP post, and file transfer resume.
http://curl.haxx.se/

In addition to searching for package names, yum's "whatprovides" option can be used to locate the package that contains a specific executable:

$ yum whatprovides /etc/yum.conf

Searching Packages:
Setting up repositories
updates-released          100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 977 kB    00:01
extras    : ################################################## 2714/2714
Added 8 new packages, deleted 0 old in 6.65 seconds

yum.noarch                               2.3.2-7                base
Matched from:
/etc/yum.conf

yum.noarch                               2.4.0-0.fc4            updates-released
Matched from:
/etc/yum.conf

yum.noarch                               2.4.0-0.fc4            installed
Matched from:
/etc/yum.conf

This example shows that /etc/yum.conf is part of the yum.noarch package.

Viewing package dependencies


Most packages that come with a Linux distributions contain one or more dependencies. A prefect example of this is the Apache web server. Apache depends on the openssl package to provide SSL support, the zlib package to deflate content, and the PHP package if PHP is in use. Managing packages and their dependencies is one area where yum really shines. Not only does yum automatically detect and resolve dependencies, but it allows you to view package dependencies with the "deplist" option:

$ yum deplist curl

Finding dependencies:
Setting up repositories
updates-released          100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
package: curl.i386 7.13.1-3
  dependency: libdl.so.2
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libkrb5.so.3
   provider: krb5-libs.i386 1.4-3
   provider: krb5-libs.i386 1.4.1-5
  dependency: libc.so.6(GLIBC_2.1)
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libcrypto.so.5
   provider: openssl.i686 0.9.7f-7
   provider: openssl.i386 0.9.7f-7
   provider: openssl.i386 0.9.7f-7.10
   provider: openssl.i686 0.9.7f-7.10
  dependency: libc.so.6
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libc.so.6(GLIBC_2.0)
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libc.so.6(GLIBC_2.3.4)
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libdl.so.2(GLIBC_2.1)
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libz.so.1
   provider: zlib.i386 1.2.2.2-3
   provider: zlib.i386 1.2.2.2-5.fc4
  dependency: libidn.so.11
   provider: libidn.i386 0.5.15-1
  dependency: libc.so.6(GLIBC_2.1.3)
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libdl.so.2(GLIBC_2.0)
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libcom_err.so.2
   provider: e2fsprogs.i386 1.37-4
   provider: e2fsprogs.i386 1.38-0.FC4.1
  dependency: /bin/sh
   provider: bash.i386 3.0-31
  dependency: openssl
   provider: openssl.i686 0.9.7f-7
   provider: openssl.i386 0.9.7f-7
   provider: openssl.i386 0.9.7f-7.10
   provider: openssl.i686 0.9.7f-7.10
  dependency: libresolv.so.2
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libc.so.6(GLIBC_2.3)
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libcurl.so.3
   provider: curl.i386 7.13.1-3
  dependency: libgssapi_krb5.so.2
   provider: krb5-libs.i386 1.4-3
   provider: krb5-libs.i386 1.4.1-5
  dependency: libkrb5support.so.0
   provider: krb5-libs.i386 1.4-3
   provider: krb5-libs.i386 1.4.1-5
  dependency: libgssapi_krb5.so.2(gssapi_krb5_2_MIT)
   provider: krb5-libs.i386 1.4-3
   provider: krb5-libs.i386 1.4.1-5
  dependency: libssl.so.5
   provider: openssl.i686 0.9.7f-7
   provider: openssl.i386 0.9.7f-7
   provider: openssl.i386 0.9.7f-7.10
   provider: openssl.i686 0.9.7f-7.10
  dependency: libc.so.6(GLIBC_2.2)
   provider: glibc.i386 2.3.5-10
   provider: glibc.i686 2.3.5-10
   provider: glibc.i386 2.3.5-10.3
   provider: glibc.i686 2.3.5-10.3
  dependency: libk5crypto.so.3
   provider: krb5-libs.i386 1.4-3
   provider: krb5-libs.i386 1.4.1-5

As you can see from the output, curl requires several packages to work as expected.

Installing and removing packages with yum


Up to this point we have shown how to use yum to view package metadata. The real heart of a package manager is its ability to install packages, remove packages, and to handle the dependencies that are associated with a specific release of a package. Yum allows packages to be installed with the "install" option, which takes one or more packages to install as arguments. The following example show how to install the curl package and all of its dependencies:

$ yum install curl

Setting up Install Process
Setting up repositories
updates-released          100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for curl to pack into transaction set.
curl-7.13.1-3.i386.rpm    100% |=========================|  10 kB    00:00
---> Package curl.i386 0:7.13.1-3 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 curl                    i386       7.13.1-3         base              262 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 262 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): curl-7.13.1-3.i386 100% |=========================| 262 kB    00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: curl                         ######################### [1/1] 

Installed: curl.i386 0:7.13.1-3
Complete!

Packages can be removed just as easily as they can be added. To remove the curl package that we just installed, the package name can be passed as an argument to the "remove" option:

$ yum remove curl

Setting up Remove Process
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package curl.i386 0:7.13.1-3 set to be erased
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
 curl                    i386       7.13.1-3         installed         521 k

Transaction Summary
=============================================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       1 Package(s)
Total download size: 0
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Removing  : curl                         ######################### [1/1]

Removed: curl.i386 0:7.13.1-3
Complete!

Checking for new package versions


One of yum's nicest features is its ability to install packages from remote repositories, and to compare the currently installed packages with what is available remotely. To compare the currently installed packages with the versions that are available in one or more remote repositories, yum can be invoked with the "check-update" option:

$ yum check-update

Setting up repositories
updates-released          100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 337 kB    00:01
updates-re: ################################################## 989/989
Added 105 new packages, deleted 83 old in 4.52 seconds
primary.xml.gz            100% |=========================| 977 kB    00:00
extras    : ################################################## 2714/2714
Added 8 new packages, deleted 0 old in 6.60 seconds

bind.i386                                24:9.3.1-14_FC4        updates-released
bind-libs.i386                           24:9.3.1-14_FC4        updates-released
bind-utils.i386                          24:9.3.1-14_FC4        updates-released
esound.i386                              1:0.2.36-0.fc4.1       updates-released
esound-devel.i386                        1:0.2.36-0.fc4.1       updates-released
gawk.i386                                3.1.4-5.3              updates-released
gdb.i386                                 6.3.0.0-1.84           updates-released
logwatch.noarch                          7.0-1.fc4              updates-released
mutt.i386                                5:1.4.2.1-4.FC4        updates-released
pam.i386                                 0.79-9.6               updates-released
pam-devel.i386                           0.79-9.6               updates-released
sudo.i386                                1.6.8p8-2.3            updates-released

In this example we can see that numerous packages are outdated by newer version. To update all of the outdated packages to newer versions, yum can be run with the "update" option:

$ yum update

Setting up Update Process
Setting up repositories
updates-released          100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for bind to pack into transaction set.
bind-9.3.1-14_FC4.i386.rp 100% |=========================|  39 kB    00:00
---> Package bind.i386 24:9.3.1-14_FC4 set to be updated
---> Downloading header for gawk to pack into transaction set.
gawk-3.1.4-5.3.i386.rpm   100% |=========================|  17 kB    00:00
---> Package gawk.i386 0:3.1.4-5.3 set to be updated
---> Downloading header for sudo to pack into transaction set.
sudo-1.6.8p8-2.3.i386.rpm 100% |=========================|  11 kB    00:00
---> Package sudo.i386 0:1.6.8p8-2.3 set to be updated
---> Downloading header for esound-devel to pack into transaction set.
esound-devel-0.2.36-0.fc4 100% |=========================| 6.6 kB    00:00
---> Package esound-devel.i386 1:0.2.36-0.fc4.1 set to be updated
---> Downloading header for pam-devel to pack into transaction set.
pam-devel-0.79-9.6.i386.r 100% |=========================|  40 kB    00:00
---> Package pam-devel.i386 0:0.79-9.6 set to be updated
---> Downloading header for bind-libs to pack into transaction set.
bind-libs-9.3.1-14_FC4.i3 100% |=========================|  31 kB    00:00
---> Package bind-libs.i386 24:9.3.1-14_FC4 set to be updated
---> Downloading header for pam to pack into transaction set.
pam-0.79-9.6.i386.rpm     100% |=========================|  62 kB    00:00
---> Package pam.i386 0:0.79-9.6 set to be updated
---> Downloading header for bind-utils to pack into transaction set.
bind-utils-9.3.1-14_FC4.i 100% |=========================|  29 kB    00:00
---> Package bind-utils.i386 24:9.3.1-14_FC4 set to be updated
---> Downloading header for esound to pack into transaction set.
esound-0.2.36-0.fc4.1.i38 100% |=========================|  11 kB    00:00
---> Package esound.i386 1:0.2.36-0.fc4.1 set to be updated
---> Downloading header for logwatch to pack into transaction set.
logwatch-7.0-1.fc4.noarch 100% |=========================|  31 kB    00:00
---> Package logwatch.noarch 0:7.0-1.fc4 set to be updated
---> Downloading header for mutt to pack into transaction set.
mutt-1.4.2.1-4.FC4.i386.r 100% |=========================|  19 kB    00:00
---> Package mutt.i386 5:1.4.2.1-4.FC4 set to be updated
---> Downloading header for gdb to pack into transaction set.
gdb-6.3.0.0-1.84.i386.rpm 100% |=========================|  48 kB    00:00
---> Package gdb.i386 0:6.3.0.0-1.84 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Updating:
 bind                    i386       24:9.3.1-14_FC4  updates-released  532 k
 bind-libs               i386       24:9.3.1-14_FC4  updates-released  779 k
 bind-utils              i386       24:9.3.1-14_FC4  updates-released  146 k
 esound                  i386       1:0.2.36-0.fc4.1  updates-released  127 k
 esound-devel            i386       1:0.2.36-0.fc4.1  updates-released   31 k
 gawk                    i386       3.1.4-5.3        updates-released  1.7 M
 gdb                     i386       6.3.0.0-1.84     updates-released  2.7 M
 logwatch                noarch     7.0-1.fc4        updates-released  217 k
 mutt                    i386       5:1.4.2.1-4.FC4  updates-released  1.1 M
 pam                     i386       0.79-9.6         updates-released  1.9 M
 pam-devel               i386       0.79-9.6         updates-released   87 k
 sudo                    i386       1.6.8p8-2.3      updates-released  185 k

Transaction Summary
=============================================================================
Install      0 Package(s)
Update      12 Package(s)
Remove       0 Package(s)
Total download size: 9.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/12): bind-9.3.1-14_FC4 100% |=========================| 532 kB    00:02
(2/12): gawk-3.1.4-5.3.i3 100% |=========================| 1.7 MB    00:03
(3/12): sudo-1.6.8p8-2.3. 100% |=========================| 185 kB    00:01
(4/12): esound-devel-0.2. 100% |=========================|  31 kB    00:00
(5/12): pam-devel-0.79-9. 100% |=========================|  87 kB    00:00
(6/12): bind-libs-9.3.1-1 100% |=========================| 779 kB    00:02
(7/12): pam-0.79-9.6.i386 100% |=========================| 1.9 MB    00:04
(8/12): bind-utils-9.3.1- 100% |=========================| 146 kB    00:00
(9/12): esound-0.2.36-0.f 100% |=========================| 127 kB    00:00
(10/12): logwatch-7.0-1.f 100% |=========================| 217 kB    00:01
(11/12): mutt-1.4.2.1-4.F 100% |=========================| 1.1 MB    00:02
(12/12): gdb-6.3.0.0-1.84 100% |=========================| 2.7 MB    00:05
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating  : bind-libs                    ####################### [ 1/24]
  Updating  : pam                          ####################### [ 2/24]
  Updating  : esound                       ####################### [ 3/24]
  Updating  : bind-utils                   ####################### [ 4/24]
  Updating  : bind                         ####################### [ 5/24]
  Updating  : gawk                         ####################### [ 6/24]
  Updating  : sudo                         ####################### [ 7/24]
  Updating  : esound-devel                 ####################### [ 8/24]
  Updating  : pam-devel                    ####################### [ 9/24]
  Updating  : logwatch                     ####################### [10/24]
  Updating  : mutt                         ####################### [11/24]
  Updating  : gdb                          ####################### [12/24]
  Cleanup   : bind                         ####################### [13/24]
  Cleanup   : gawk                         ####################### [14/24]
  Cleanup   : sudo                         ####################### [15/24]
  Cleanup   : esound-devel                 ####################### [16/24]
  Cleanup   : pam-devel                    ####################### [17/24]
  Cleanup   : bind-libs                    ####################### [18/24]
  Cleanup   : pam                          ####################### [19/24]
  Cleanup   : bind-utils                   ####################### [20/24]
  Cleanup   : esound                       ####################### [21/24]
  Cleanup   : logwatch                     ####################### [22/24]
  Cleanup   : mutt                         ####################### [23/24]
  Cleanup   : gdb                          ####################### [24/24]

Updated: bind.i386 24:9.3.1-14_FC4 bind-libs.i386 24:9.3.1-14_FC4 bind-utils.i386 24:9.3.1-14_FC4 esound.i386
1:0.2.36-0.fc4.1 esound-devel.i386 1:0.2.36-0.fc4.1 gawk.i386 0:3.1.4-5.3 gdb.i386 0:6.3.0.0-1.84 logwatch.noarch
0:7.0-1.fc4 mutt.i386 5:1.4.2.1-4.FC4 pam.i386 0:0.79-9.6 pam-devel.i386 0:0.79-9.6 sudo.i386 0:1.6.8p8-2.3
Complete!

If you would prefer to update a single package, you can pass the package name as an argument to the yum update option.

Cleaning up the yum cache


The yum package manager maintains a cache of headers and files in /var/cache/yum. This cache can grow rather large over time, and can be cleaned with the yum "clean" option:

$ yum clean all

Cleaning up Everything
251 headers removed
251 packages removed
6 metadata files removed
0 cache files removed
3 cache files removed

You can also clean individual items such as headers and packages by passing the item to clean to the clean option. Since the yum cache can consume a fair amount of disk space, the clean option should be used periodically to free up disk space.

Getting E-mail notifications when new packages are available


The process of managing packages is tedious, and having to manually check for updates is a pain. To simplify this process, I developed the yumnotifier shell script. Yumnotifier will process the output from the check-update command, and if it determines that updates are available, it will E-mail the address defined in the global $ADMIN variable. The script is designed to be run from cron, and will generate an E-mail similar to the following if updates are available:

From root@localhost.localdomain  Sat Jul 15 19:24:59 2006
Date: Sat, 15 Jul 2006 19:24:59 -0400
From: root <root@localhost.localdomain>
To: matty@localhost.localdomain
Subject: Updates available for biscuit

==== The following updates are available for biscuit ===

comps.i386                               2:4.3CENTOS-0.20060314 base            
gtk2.i386                                2.4.13-18              base            
kernel.i686                              2.6.9-34.0.2.EL        update          
libtiff.i386                             3.6.1-10               update          
mysql.i386                               4.1.20-1.RHEL4.1       update          
mysql-devel.i386                         4.1.20-1.RHEL4.1       update          
newt.i386                                0.51.6-7.rhel4         base            
php.i386                                 4.3.9-3.15             update          
php-ldap.i386                            4.3.9-3.15             update          
php-pear.i386                            4.3.9-3.15             update          
postgresql-libs.i386                     7.4.13-2.RHEL4.1       update          
rpmdb-CentOS.i386                        2:4.3-0.20060314       base            
sendmail.i386                            8.13.1-3.RHEL4.5       update          
sendmail-cf.i386                         8.13.1-3.RHEL4.5       update          
spamassassin.i386                        3.0.6-1.el4            update          
vixie-cron.i386                          4:4.1-44.EL4           update          
xorg-x11-Mesa-libGL.i386                 6.8.2-1.EL.13.25.1     update          
xorg-x11-font-utils.i386                 6.8.2-1.EL.13.25.1     update          
xorg-x11-libs.i386                       6.8.2-1.EL.13.25.1     update          
xorg-x11-xauth.i386                      6.8.2-1.EL.13.25.1     update          
xorg-x11-xfs.i386                        6.8.2-1.EL.13.25.1     update        

To apply the updates in the output, the yum "update" or "upgrade" options can be used.

Conclusion


As we have seen in this article, yum comes with several options to search, install and remove the packages on a system. These features make yum a powerful package manager, and the ability to retrieve and update package from remote locations make it a perfect solution for most environments. If you have questions or comments on the article, please feel free to E-mail the author.

References