YUM (Yellowdog Updater Modified)
Yellowdog Update, Modified (YUM)is a package manager that was developed by Duke University
to improve the installation of RPMs. yumsearches numerous repositories for packages and their
dependencies so they may be installed together in an effort to alleviate dependency issues. Red Hat
Enterprise Linux 5.2 uses yumto fetch packages and install RPMs.
up2date is now deprecated in favor of yum(Yellowdog Updater Modified). The entire stack of tools
which installs and updates software in Red Hat Enterprise Linux 5.2 is now based on yum. This
includes everything, from the initial installation via Anaconda to host software management tools like
yumalso allows system administrators to configure a local (i.e. available over a local network)
repository to supplement packages provided by Red Hat. This is useful for user groups that use
applications and packages that are not officiallysupported by Red Hat.
Aside from being able to supplement available packages for local users, using a local yum repository
also saves bandwidth for the entire network. Further, clients that use local yumrepositories do not
need to be registered individually to install or update the latest packages from Red Hat Network.
12.1. Setting Up a Yum Repository
To set up a repository for Red Hat Enterprise Linux packages, follow these steps:
1. Install the createrepo package:
~]# yum install createrepo
2. Copy all the packages you want to provide in the repository into one directory (/mnt/
local_repo for example).
3. Run createrepo on that directory (for example, createrepo /mnt/local_repo). This will
create the necessary metadata for your Yum repository.
12.2. yum Commands
yumcommands are typically run as yum <command> <package name/s> . By default, yum will
automatically attempt to check all configured repositories to resolve all package dependencies during
The following is a list of the most commonly-used yum commands. For a complete list of available yum
commands, refer to man yum.
yum install <package name/s>
Used to install the latest version of a package or group of packages. If no package matches the
specified package name(s), they are assumed to be a shell glob, and any matches are then
yum update <package name/s>
Used to update the specified packages to the latest available version. If no package name/s are
specified, then yum will attempt to update all installed packages.
If the --obsoletes option is used (i.e. yum --obsoletes <package name/s> , yum will
process obsolete packages. As such, packages that are obsoleted accross updates will be
removed and replaced accordingly.
This command allows you to determine whether any updates are available for your installed
packages. yum returns a list of all package updates from all repositories if any are available.
yum remove <package name/s>
Used to remove specified packages, along with any other packages dependent on the packages
yum provides <file name>
Used to determine which packages provide a specific file or feature.
yum search <keyword>
This command is used to find any packages containing the specified keyword in the description,
summary, packager and package name fields of RPMs in all repositories.
yum localinstall <absolute path to package name/s>
Used when using yumto install a package located locally in the machine.
12.3. yum Options
yumoptions are typically stated before specific yum commands; i.e. yum <options> <command>
<package name/s> . Most of these options can be set as default using the configuration file.
The following is a list of the most commonly-used yumoptions. For a complete list of available yum
options, refer to man yum.
Answer "yes" to every question in the transaction.
Sets yumto be "tolerant" of errors with regard to packages specified in the transaction. For
example, if you run yum update package1 package2 and package2 is already installed, yum
will continue to install package1.
Excludes a specific package by name or glob in a specific transaction.
12.4. Configuring yum
By default, yumis configured through /etc/yum.conf. The following is an example of a typical /
name=RHEL 5 $releasever - $basearch
A typical /etc/yum.conf file is made up of two types of sections: a [main] section, and a
repository section. There can only be one [main] section, but you can specify multiple repositories in
a single /etc/yum.conf.
12.4.1. [main] Options
The [main] section is mandatory, and there must only be one. For a complete list of options you can
use in the [main] section, refer to man yum.conf.
The following is a list of the most commonly-used options in the [main] section.
This option specifies the directory where yumshould store its cache and database files. By default,
the cache directory of yumis /var/cache/yum.
keepcache=<1 or 0>
Setting keepcache=1 instructs yumto keep the cache of headers and packages after a
successful installation. keepcache=1 is the default.
reposdir=<absolute path to directory of .repo files>
This option allows you to specify a directory where .repo files are located. .repo files contain
repository information (similar to the [repository] section of /etc/yum.conf).
yumcollects all repository information from .repo files and the [repository] section of the
/etc/yum.conf file to create a master list of repositories to use for each transaction. Refer to
Sección 12.4.2, “ [repository] Options” for more information about options you can use for
both the [repository] section and .repo files.
If reposdir is not set, yumuses the default directory /etc/yum.repos.d.
gpgcheck=<1 or 0>
This disables/enables GPG signature checking on packages on all repositories, including local
package installation. The default is gpgcheck=0, which disables GPG checking.
If this option is set in the [main] section of the /etc/yum.conf file, it sets the GPG checking
rule for all repositories. However, you can also set this on individual repositories instead; i.e., you
can enable GPG checking on one repository while disabling it on another.
assumeyes=<1 or 0>
This determines whether or not yumshould prompt for confirmation of critical actions. The default
if assumeyes=0, which means yum will prompt you for confirmation.
If assumeyes=1 is set, yumbehaves in the same way that the command line option -y does.
tolerant=<1 or 0>
When enabled (tolerant=1), yum will be tolerant of errors on the command line with regard to
packages. This is similar to the yumcommand line option -t.
The default value for this is tolerant=0 (not tolerant).
This option allows you to exclude packages by keyword during installation/updates. If you are
specifying multiple packages, this is a space-delimited list. Shell globs using wildcards (for
example, * and ?) are allowed.
retries=<number of retries>
This sets the number of times yumshould attempt to retrieve a file before returning an error.
Setting this to 0 makes yum retry forever. The default value is 6.
12.4.2. [repository] Options
The [repository] section of the /etc/yum.conf file contains information about a repository
yumcan use to find packages during package installation, updating and dependency resolution. A
repository entry takes the following form:
baseurl=url, file or ftp://path to repository
You can also specify repository information in a separate .repo files (for example, rhel5.repo). The
format of repository information placed in .repo files is identical with the [repository] of /etc/
.repo files are typically placed in /etc/yum.repos.d, unless you specify a different repository path
in the [main] section of /etc/yum.conf with reposdir=. .repo files and the /etc/yum.conf
file can contain multiple repository entries.
Each repository entry consists of the following mandatory parts:
The repository ID is a unique, one-word string that serves as a repository identifier.
This is a human-readable string describing the repository.
baseurl=http, file or ftp://path
This is a URL to the directory where the repodatadirectory of a repository is located. If the
repository is local to the machine, use baseurl=file://path to local repository . If
the repository is located online using HTTP, use baseurl=http://link . If the repository is
online and uses FTP, use baseurl=ftp://link .
If a specific online repository requires basic HTTP authentication, you can specify your username
and password in the baseurl line by prepending it as username:password@link. For
example, if a repository on http://www.example.com/repo/ requires a username of "user" and
a password os "password", then the baseurl link can be specified as baseurl=http://
The following is a list of options most commonly used in repository entries. For a complete list of
repository entries, refer to man yum.conf.
gpgcheck=<1 or 0>
This disables/enables GPG signature checking a specific repository. The default is
gpgcheck=0, which disables GPG checking.
This option allows you to point to a URL of the ASCII-armoured GPG key file for a
repository. This option is normally used if yumneeds a public key to verify a package and
the required key was not imported into the RPM database.
If this option is set, yum will automatically import the key from the specified URL. You
will be prompted before the key is installed unless you set assumeyes=1 (in the
[main] section of / etc/yum.conf) or -y (in a yumtransaction).
This option is similar to the exclude option in the [main] section of /etc/yum.conf.
However, it only applies to the repository in which it is specified.
This option is the opposite of exclude. When this option is set on a repository, yum will
only be able to see the specified packages in that repository. By default, all packages in
a repository are visible to yum.
12.5. Useful yum Variables
The following is a list of variables you can use for both yumcommands and yum configuration
/etc/yum.conf and .repo files).
This is replaced with the package's version, as listed in distroverpkg. This
defaults to the version of the redhat-release package.
This is replaced with your system's architecture, as listed by os.uname() in Python.
This is replaced with your base architecture. For example, if $arch=i686 then
This is replaced with the value of the shell environment variable of the same name. If
the shell environment variable does not exist, then the configuration file variable will
not be replaced.