On Red Hat Enterprise Linux and similar systems, you install and update software from repositories, the sources that hold packages. The yum command searches those repositories, installs what you pick and pulls in the other packages it depends on.
This cheat sheet gives you the yum commands for everyday package work and shows how to read a transaction before you accept it.
What is the yum command?
Yum is a command-line interface for managing RPM software packages through repositories. It can search package metadata, install or remove packages, and resolve dependencies as part of a transaction.
On RHEL 8, YUM is based on DNF technology and the YUM command line remains broadly compatible with RHEL 7. RHEL 9 documents DNF commands, and the current yum manual page redirects to the DNF command reference.
I chose the current yum manual over the older cheat sheet as the command reference, because it redirects yum to DNF.
| Term | Role |
|---|---|
| RPM | Package format and low-level package database |
| Repository | Source of package metadata and packages |
| yum | Package-management command or compatibility interface |
| DNF | Current package-management tool on current RHEL releases |
Prerequisites for using yum
Run yum on an RPM-based system that provides yum or a compatible DNF command. Package operations also need configured repositories, and installing, updating, or removing system packages requires administrative privileges.
- Check which command your host provides with command -v yum or command -v dnf.
- Use sudo for a system-wide package change when your account is not root.
- Read the proposed transaction before confirming package changes.
If neither command exists, do not install a random yum package on a different distribution. Follow that distribution’s package manager or its official instructions for RPM tooling. The Linux package-management overview compares the common package tools by distribution.
Use yum for common package tasks
These commands use the yum-compatible interface. Replace the package name with one from your enabled repositories, and use sudo for operations that change the system.
1. Search for a package
Search by a name when you do not know the exact package name, and remember that results depend on enabled repositories.
yum search syncthing
2. Install a package
After identifying the package name, ask yum to install it. The package manager calculates dependencies and presents a transaction for confirmation.
sudo yum install syncthing
A successful install means the transaction completed, but that alone does not configure or start the application. Omit sudo only in an existing root shell.
3. Inspect package information
Use info for package details and list for installed or available package records. These queries help distinguish a package that is installed from one that a repository offers.
yum info syncthing
yum list --installed
yum list --available
To filter the installed-package list, pipe it to grep and search for a name:
yum list --installed | grep vim
The filter matches text in the command output, so it is a quick lookup rather than a structured package query. See the grep command reference for matching options.
4. Upgrade packages
Check for available updates before applying them. A system upgrade can change dependencies as well as named packages, so review the transaction summary before accepting it.
yum check-update
sudo yum upgrade
Add a package name when you intend to upgrade one package rather than the whole installed set. Available versions and dependency changes come from enabled repositories.
sudo yum upgrade syncthing
5. Remove or reinstall a package
Remove uninstalls the named package and may also remove packages that depend on it. Inspect the full transaction before confirming.
sudo yum remove syncthing
Reinstall replaces files for a package that is installed and available in an enabled repository.
For package removal details, see the separate guide to uninstalling packages with YUM.
sudo yum reinstall syncthing
Check what a yum transaction will change
Yum groups a package operation and its dependency changes into a transaction. Read the package names and the proposed action before answering its confirmation prompt, especially when removing or upgrading packages.
yum check-update
For DNF, check-update returns status 100 when updates are available and 0 when none are available. The manual lists status 1 for an error.
- Confirm the package names and versions in the proposed transaction.
- Check whether dependencies will be installed, upgraded, or removed.
- Cancel if the change is broader than the task you intended.
The RHEL 9 DNF guide describes the package manager used on that release, and the DNF command reference covers the parallel workflow. Plugins and release details can change behavior.
When yum is unavailable or behaves differently
| Symptom | Likely reason | Next check |
|---|---|---|
| yum: command not found | The host may provide dnf instead, or may not be RPM-based | Check the distribution’s package-management documentation |
| Package search returns nothing | The name may differ or a needed repository may be disabled | Check spelling and enabled repositories |
| Install proposes unexpected removals | Dependencies or package conflicts affect the transaction | Decline and inspect the package and repository choices |
Do not assume every system using RPM has the same command or repositories. The RPM installation guide explains how an RPM package relates to the system’s package manager, while the Yum Extender overview covers a graphical Fedora package workflow.
Choose the package tool your host provides
The useful distinction is the command your distribution supports, not the name printed in an old cheat sheet. Check the host first, then use its package manager and inspect each proposed transaction.
command -v yum || command -v dnf
Yum command questions
What does the yum command do in Linux?
Yum manages RPM software packages through repositories. It can search for packages and install, inspect, update, or remove them while resolving dependencies as part of a transaction.
How do I install a package with yum?
Run sudo yum install package-name on a host that provides yum or a compatible command. Review the proposed transaction before confirming it.
Is yum compatible with DNF?
RHEL 8 YUM is based on DNF and keeps compatibility with RHEL 7 YUM command-line usage. The current yum manual page redirects to the DNF command reference, but check your host’s release documentation.
How do I list installed packages with yum?
Run yum list –installed to ask yum-compatible tooling for the installed package list. You can filter its output with grep when you are looking for a name.
