yum install: Usage, Options & Common CI Errors
yum install adds packages on older Red Hat systems (CentOS 7, RHEL 7).
yum is the legacy package manager on RHEL 7 / CentOS 7. On RHEL 8+ it is a compatibility symlink to dnf. The dominant CI failure today is CentOS 7 reaching end-of-life and its mirrors going offline.
What it does
yum install resolves and installs packages with their dependencies from the configured .repo files. On modern Red Hat releases yum is just an alias for dnf, so the flags are largely identical; on CentOS 7 it is the real, older implementation.
Common usage
yum install -y git curl
yum install -y epel-release # enable EPEL
yum install -y --enablerepo=epel htop
yum clean all && rm -rf /var/cache/yumCommon errors in CI
CentOS 7 hit EOL on 2024-06-30, so "Could not resolve host: mirrorlist.centos.org" or "Cannot find a valid baseurl for repo: base/7" now breaks many old images - point the .repo files at vault.centos.org instead. "No package X available" means the repo (often EPEL) is not enabled. "Public key for X is not installed" needs the repo GPG key imported (rpm --import). Prefer migrating CI to dnf on a supported base (Rocky/Alma/RHEL 8+).
Options
| Flag | What it does |
|---|---|
| -y / --assumeyes | Assume yes (required in CI) |
| --enablerepo / --disablerepo | Toggle a repo for this run |
| --nogpgcheck | Skip GPG verification |
| clean all | Purge cached metadata and packages |