Beginners Guide to yum Configuration

All software on a Linux system is divided into packages that can be installed, uninstalled, upgraded, queried, and verified. CentOS/RHEL systems use the Red Hat Package Manager (RPM) to facilitate the installation, upgrade and removal of software packages.

CentOS/RHEL also provides the yum(Yellowdog Updater, Modified) utility, which works with RPM packages. When yum installs or upgrades a software package, it also installs or upgrades any package dependencies. The yum utility downloads package headers and packages from repositories. Repositories are storage locations from which software packages can be retrieved and installed.

Yum Configuration Files

The main configuration file for yum is /etc/yum.conf. Configuration files that define repositories are in the /etc/yum.repos.d directory. An example of /etc/yum.conf follows here:

The yum utility is often the fastest way to perform package management tasks. It provides capabilities beyond those provided by rpm and by graphical package management tools. There are many yum commands, but the following provides examples of common tasks.

Listing Packages

There are several yum commands to list packages in any repository enabled on your system or installed. You can list specific types of packages as well as refine your list with a package specification of any package’s name, architecture, version, or release.

To list all packages in all the repositories and all the packages installed on your system, use the following command:

# yum list

To list all the packages installed on the system, use the following command:

# yum list installed

To list all the packages available to be installed in any enabled repository on your system, use the following command:

# yum list available

The following example finds the name of the package that a file (for example, /etc/sysconfig/atd) belongs to:

Checking for Updates

To see which installed packages on your system have updates available, use the following command:

# yum check-update

The package name plus architecture, the version of the updated package, and the repository (or
ULN channel) are displayed. Entering yum list update returns the same output.

Updating Packages

You can choose to update a single package, multiple packages, or all packages at once. If any dependencies of the package (or packages) have updates available, they are updated also.

Updating a Single Package

To update a single package, use the following command syntax:

# yum update package_name

For example, to update the bind-libs package, enter:

# yum update bind-libs

yum checks for dependencies, displays dependencies resolved and a transaction summary, prompts “Is this ok [y/N]“, waits for your response, and then downloads and installs the package and any dependent packages needed. Use yum -y to bypass the prompt.

Updating All Packages

To update all packages and their dependencies, enter yum update (without any arguments):

# yum update

Installing Packages

To install a new package together with any package dependencies, use the following syntax:

# yum install package_name

For example, to install the zsh package, enter:

# yum install zsh

Updating and Installing Kernels

You do not need to worry about the distinction between installing and upgrading a kernel package when you use yum. yum always installs a new kernel regardless of whether you are using yum update or yum install.