yum — quick reference
Install and remove
| When to use | Command |
|---|---|
| Install a package and dependencies | sudo yum install package_name |
| Install without prompts | sudo yum install -y package_name |
| Remove a package | sudo yum remove package_name |
| Reinstall to repair files | sudo yum reinstall package_name |
| Download RPMs without installing | sudo yum install pkg --downloadonly --downloaddir=/path |
Update and upgrade
| When to use | Command |
|---|---|
| Update one package | sudo yum update package_name |
| Update every installed package | sudo yum update |
| List available updates only | sudo yum check-update |
Search and inspect
| When to use | Command |
|---|---|
| Search repositories by keyword | sudo yum search keyword |
| List installed and available packages | sudo yum list |
| List installed packages only | sudo yum list installed |
| Show package metadata | sudo yum info package_name |
| Find RPM that provides a file | sudo yum provides /path/to/file |
| Wildcard provides search | sudo yum provides '*/binary' |
Repositories
| When to use | Command |
|---|---|
| List enabled repositories | sudo yum repolist |
| List disabled repositories | sudo yum repolist disabled |
| List all repositories | sudo yum repolist all |
| Enable one repo for this command | sudo yum install pkg --enablerepo=repo_id |
| Disable broken repos for one install | sudo yum install pkg --disablerepo=badrepo |
Groups, history, and cache
| When to use | Command |
|---|---|
| List package groups | sudo yum grouplist |
| Install a group | sudo yum groupinstall "Group Name" |
| Remove a group | sudo yum groupremove "Group Name" |
| Update a group | sudo yum groupupdate "Group Name" |
| Show transaction history | sudo yum history |
| Undo one transaction | sudo yum history undo ID |
| Redo a transaction | sudo yum history redo ID |
| Roll back after a transaction ID | sudo yum history rollback ID |
| Clean cached metadata and packages | sudo yum clean all |
| Interactive yum shell | sudo yum shell |
Help and version
| When to use | Command |
|---|---|
| Show yum version | yum --version |
| Show command help | yum help install |
yum — command syntax
Synopsis from yum(8) on man7.org (RHEL 7 era):
yum [options] [command] [package ...]Repository files live in /etc/yum.repos.d/*.repo. Cached metadata and RPMs use /var/cache/yum/. On RHEL 8+, yum often forwards to dnf — this page targets YUM 3 on RHEL 7 where the Python stack is native.
yum — command examples
Essential Install a package with dependencies
Install a monitoring tool — yum pulls dependencies from enabled repos automatically. The example installs iotop; after setup, see iotop for per-process disk I/O.
Run the command:
sudo yum install -y iotopSample output:
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package iotop.noarch 0:0.6-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
iotop noarch 0.6-4.el7 base 52 k
Transaction Summary
================================================================================
Install 1 Package
Installed:
iotop.noarch 0:0.6-4.el7
Complete!Essential Remove an installed package
Remove software that is no longer needed. yum erases the package RPM; dependencies may stay if other packages require them.
Run the command:
sudo yum remove -y iotopSample output:
Resolving Dependencies
---> Package iotop.noarch 0:0.6-4.el7 will be erased
...
Removed:
iotop.noarch 0:0.6-4.el7
Complete!Essential Update installed packages
Apply updates from enabled repos. Without a package name, yum updates everything with a newer version available.
Run the command:
sudo yum update -yPreview updates first:
sudo yum check-updateSample output (single-package update excerpt):
---> Package NetworkManager.i686 1:1.18.8-1.el7 will be updated
---> Package NetworkManager.i686 1:1.18.8-2.el7_9 will be an update
...
Updated:
NetworkManager.i686 1:1.18.8-2.el7_9
Complete!Common Search and inspect packages
Find the correct package name before installing on RHEL 7.
Run the commands:
sudo yum search nginx
sudo yum info nginxSample output:
Loaded plugins: fastestmirror, langpacks
========================= N/S matched: nginx =========================
nginx.x86_64 : A high performance web server and reverse proxy server
...
Name : nginx
Arch : x86_64
Version : 1.20.1
Release : 10.el7
Summary : A high performance web server and reverse proxy serverCommon List what is already installed
Audit software inventory or confirm a package version before a change window.
Run the command:
sudo yum list installed | head -20Sample output:
Loaded plugins: fastestmirror, langpacks
Installed Packages
GConf2.i686 3.2.6-8.el7 @anaconda
GeoIP.i686 1.5.0-14.el7 @anaconda
NetworkManager.i686 1:1.18.8-2.el7_9 @updates
bash.i686 4.2.46-34.el7 @anaconda
...Common Find which RPM owns a command
When /usr/sbin/useradd is missing on a minimal image, ask yum which package to install.
Run the command:
sudo yum provides /usr/sbin/useraddSample output:
Loaded plugins: fastestmirror, langpacks
shadow-utils-2:4.6-12.el7.x86_64 : Utilities for managing accounts and shadow password files
Repo : base
Matched from:
Filename : /usr/sbin/useraddUse yum provides '*/name' when multiple paths match.
Common Work with repositories
List enabled mirrors, then install from one repo while disabling broken media repos.
Run the commands:
sudo yum repolist
sudo yum install -y iotop --disablerepo=c8-media-BaseOS,c8-media-AppStreamSample output:
repo id repo name status
base/7/x86_64 CentOS-7 - Base 7,611
extras/7/x86_64 CentOS-7 - Extras 404
updates/7/x86_64 CentOS-7 - Updates 1,992
repolist: 10,007
...
Installed:
iotop.noarch 0:0.6-4.el7
Complete!Common Install a package group
Install a bundle such as compatibility libraries or development tools in one transaction.
Run the commands:
sudo yum grouplist
sudo yum groupinstall -y "Development Tools"Sample output (truncated):
Available Groups:
Development Tools
Security Tools
...
Installed:
gcc.x86_64 4.8.5-44.el7
make.x86_64 1:3.82-24.el7
...
Complete!Advanced Undo a yum transaction
Reverse a mistaken install using the ID from history — safer than guessing which RPMs to erase.
Run the commands:
sudo yum history
sudo yum history undo 10Sample output:
ID Login user Date and time Action(s)
10 root 2026-07-01 14:00 Install iotop-0.6-4.el7.noarch
...
Undoing transaction 10 ...
Removed:
iotop.noarch 0:0.6-4.el7
Complete!See YUM history and rollback for rollback vs redo semantics.
Advanced Download RPMs without installing
Stage packages on a jump host for air-gapped installs.
Run the command:
sudo yum install -y mariadb --downloadonly --downloaddir=/root/rpms
ls /root/rpms/mariadb*Sample output:
...
Complete!
/root/rpms/mariadb-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpm
/root/rpms/mariadb-common-10.3.28-1.module_el8.3.0+757+d382997d.x86_64.rpmConfirm nothing was installed:
rpm -qa | grep mariadbEmpty output means the download-only path worked.
yum — when to use / when not
| Use yum when | Use something else when |
|---|---|
|
|
yum vs dnf
| yum (RHEL 7) | dnf (RHEL 8+) | |
|---|---|---|
| Resolver | Python yum stack | libsolv |
| Group install | yum groupinstall |
dnf group install |
| Default today | Legacy enterprise | Current Fedora/RHEL |
| On RHEL 8+ | Often symlink to dnf | Native |
Plan migrations by testing playbooks with dnf subcommands before decommissioning RHEL 7 hosts.
Related commands
RPM-family package management.
| Command | One line |
|---|---|
| yum | Legacy package manager on RHEL 7 (this page) |
Browse the full index in our Linux commands reference.
yum — interview corner
What is yum in Linux?
YUM (Yellowdog Updater Modified) is the classic RPM package manager front end on RHEL 7-era systems. It reads repository metadata from /etc/yum.repos.d/, resolves dependencies, and runs install/update/remove transactions.
It replaced manual rpm -i chains for most admin work and records history so mistakes can be undone.
A strong answer is:
"yum is the legacy RPM package manager on RHEL 7 — repo-based installs with dependency resolution and transaction history. On RHEL 8+ I use dnf, which replaced the yum Python resolver."
Where does yum get packages from?
From YUM repositories defined in /etc/yum.repos.d/*.repo. Each file lists mirror URLs, GPG keys, and whether the repo is enabled.
Without at least one enabled repo (or a local mirror), yum install fails with no enabled repos.
List them:
yum repolistA strong answer is:
"yum pulls from .repo files under /etc/yum.repos.d — baseurl or mirrorlist, gpgcheck, enabled flag. I run yum repolist to confirm repos before troubleshooting failed installs."
How do yum history undo and rollback differ?
| Command | Effect |
|---|---|
yum history undo ID |
Reverses that one transaction |
yum history redo ID |
Repeats that transaction |
yum history rollback ID |
Reverses all transactions after ID |
Rollback is powerful and can remove many packages — use snapshots on production before wide rollbacks.
A strong answer is:
"undo reverses a single transaction ID; rollback reverses everything after an ID. I start with undo for one bad install and treat rollback as a last resort with backups."
When do you use yum provides instead of rpm -qf?
yum provides /path/file searches repository metadata — it tells you which not-yet-installed RPM to install.
rpm -qf /path/file only works for files already on disk from an installed package.
Use provides on minimal systems when a command is missing; use rpm -qf to audit existing files.
A strong answer is:
"yum provides searches repos for who owns a path — great when the file isn't installed yet. rpm -qf only works for files already on the system from an installed RPM."
What changes when migrating from yum to dnf?
Commands look similar (install, remove, search, history) but watch for:
- Group commands:
groupinstall→group install - Faster metadata and stricter dependency errors (libsolv)
- Plugins and option names may differ
On RHEL 8+, many systems already run dnf when you type yum.
A strong answer is:
"Most verbs match, but dnf uses libsolv, group install syntax changes, and on RHEL 8+ yum often is dnf already. I test playbooks on dnf explicitly before retiring RHEL 7."
Troubleshooting
| Symptom | Likely cause | What to try |
|---|---|---|
There are no enabled repos |
Missing or disabled .repo files |
Register RHEL; copy CentOS vault repos; yum repolist all |
| Metadata download / mirror errors | Dead mirror or DVD repo paths | yum clean all; --disablerepo= broken IDs |
| Dependency conflicts | Multilib or pinned packages | Read transaction check output; remove conflicting package |
yum hangs on plugins |
fastestmirror or security plugin | yum --disableplugin=fastestmirror install ... |
| Wrong tool on RHEL 8+ | Expecting YUM 3 behaviour | Confirm with yum --version; use dnf docs |
