Yum is a package manager for Linux systems that rose to prominence for being the default package management system for Red Hat Enterprise Linux and its derivative distributions for many years. It has since been replaced by dnf package manager, which is a fork of yum that has been developed to be faster, more efficient, and have better documentation. Modern Linux distros only use yum as a compatibility layer for dnf, in order to accomodate legacy Bash scripts and old commands.
Most likely, you ended up on this page because you attempted to execute a yum command that you found online and got an error. But this is because you are not using a Linux distro that utilizes the yum package manager. Find out what your default package manager is (e.g., Ubuntu uses apt, and Arch uses pacman, etc), and instead use that package manager to install the software.
In this tutorial, we will go over the step by step instructions to install yum and dnf on on all major Linux distros. Then, we will go over a few commands and examples to help you get started installing packages with your new package manager.
Yum is outdated (latest release is from 2011) and has been superseded by dnf. In most cases, you will want to install dnf or just stick with your distribution’s default package manager. On older systems, yum can still be used, but otherwise it only remains relevant today as a compatibility layer that hands off instructions to dnf.
In this tutorial you will learn:
- How to install yum / dnf on all major Linux distros
- How to add a repository to dnf
- How to search for, install, update, and remove a package with yum / dnf
|Requirements, Conventions or Software Version Used
|Any Linux distro
|yum / dnf
|Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to Install Yum on Linux step by step instructions
The process of installing yum or dnf will be a little different depending on your Linux distribution and how old it is. We have divided the installation instructions by distribution below. After installing the package manager, you can see our usage examples to learn how to install packages.
RHEL, Fedora, CentOS, AlmaLinux, Rocky Linux
On modern versions of RHEL based distributions like Fedora, CentOS, AlmaLinux, and Rocky Linux, the dnf package manager will already be installed by default. You can still access the
yum command as well, but this is just a symbolic link to the dnf executable.
$ ls -l /usr/bin/yum lrwxrwxrwx. 1 root root 5 Sep 9 09:05 /usr/bin/yum -> dnf-3
CentOS 7 and older RHEL-based distros
On RHEL 7, CentOS 7, and other RHEL based distributions that are outdated, yum is already the default package manager. You can continue to use it until you upgrade to a modern version of the operating system, at which point you will need to switch to using dnf.
Ubuntu 18.04 and Debian 10
Slightly older versions of Debian and Ubuntu can still install and use yum, although it is recommended that you opt for dnf instead. To install yum on Ubuntu 18.04, Debian 10, and older versions of the operating systems:
$ sudo apt update $ sudo apt install yum
Or to install dnf:
$ sudo apt install dnf
Ubuntu and Debian
On modern versions of Ubuntu, Debian, and some other derivatives, you can install the dnf package manager:
$ sudo apt update $ sudo apt install dnf
You can also install a yum compatibility layer if necessary:
$ sudo apt install nextgen-yum4
This will also install dnf as a dependency (if not already installed) and gives access to the
yum4 command. This just takes old yum commands and sends them straight to dnf for you.
Arch Linux and Manjaro
Yum can be installed from the Arch User Repository. The simplest way is to use an AUR helper like yay (see the linked tutorial if you need help installing yay):
$ yay -s yum
Or just use Pacman if you want to install dnf instead:
$ sudo pacman -S dnf
yum / dnf usage examples
Now that you have yum and/or dnf installed on your system, let’s see how to use it. We will be using
dnf commands in the examples below, but you can substitute in the
yum command or
yum4 command if you installed one of the yum packages:
- To search for a package in yum/dnf:
$ dnf search [package]
- To install a package in yum/dnf:
$ sudo dnf install [package]
- To upgrade all installed packages in yum/dnf:
$ sudo dnf update
- To remove a package in yum/dnf:
$ sudo dnf remove [package]
There are plenty of other
yum commands, and you can view them in the manual:
$ man dnf and $ man yum
In this tutorial, we saw how to install the Yum package manager on a Linux system. Since Yum has fallen out of date and is no longer developed, we also showed how to install dnf, which was forked from yum and has been vastly improved. In most cases, you really should stick with your default package manager and only consider supplemental ones like Flatpak or Homebrew, as default package managers like apt and pacman already do a fine job on other systems and dnf or yum should not be necessary.