Linux Commands | Package Management | yum

What is yum?

  • It is one of the package management systems.
  • It stands for Yellowdog Updater Modified. It is an improved version of Yellowdog Updater.
  • It was developed by Duke University’s Linux@DUKE project.
  • It was adopted as the standard package management system for Red Hat-based Linux distributions such as Red Hat Enterprise Linux (RHEL), CentOS, and Fedora.
  • With RPM, package URLs were specified up to the version number and installed one by one. yum provides features such as installing the latest available version of a package, automatically installing dependent packages, and searching packages by keyword.
  • Starting with RHEL 8 and CentOS 8, the yum command was changed to the dnf command, but most arguments remain almost the same, and the following commands can also be used with dnf.

How to Use Yum

Install a package

$ yum install <package-name>
$ yum -y install <package-name>	 # Skip the install? (y/N) prompt

Check packages with available updates

$ yum check-update

Update a specific package

$ yum update <package-name>

Update all packages

$ yum update
$ yum upgrade ← Same as yum update --obsoletes

Remove a package

$ yum erase <package-name>

List installed packages

$ yum list installed

List installable packages

$ yum list

Search for packages containing a specific word

$ yum search <string>

Show detailed information about a package

$ yum info <package-name>

List repositories to reference

$ yum repolist

Repositories

yum retrieves packages from repositories.

  • For RHEL (Red Hat Enterprise Linux), it uses Red Hat repositories.
  • For CentOS, it downloads packages from repositories provided by the CentOS Project.

Repository lists are configured under the /etc/yum.repos.d directory.

EPEL

In addition to the standard repositories provided by Red Hat and the CentOS Project, there is also the EPEL (Extra Packages for Enterprise Linux) repository provided by the Fedora Project. It is not as stable as the standard repositories, but it contains additional packages.

To reference EPEL, install the EPEL repository configuration file under /etc/repos.d/.

$ yum -y install epel-release

To keep the EPEL repository disabled normally and enable it only when specified from the command line, configure it as follows.

$ vi /etc/yum.repos.d/epel.repo

enabled= 0

$ yum install package-name --enablerepo=epel