Install Specific Version with Yum: 5 Proven Steps, 2 Traps

To install specific version packages with yum, list the versions with yum --showduplicates list and install the exact name-version string, for example yum install nginx-1:1.14.1-9.module+el8.4.0+542+81547229. That was the whole of the 2020 version of this post. In practice two things decide whether it works: module streams, which hide most versions on EL8 and EL9, and versionlock, which keeps the version you chose. I tested everything on 22 November 2026 in Rocky Linux 8.10 and 9.9 containers, where yum is a link to dnf-3 (dnf 4.7.0 and 4.14.0), using nginx as the example package.

Step 1: list the versions you can install

$ yum -q --showduplicates list nginx        # Rocky 9.9
Available Packages
nginx.x86_64               2:1.20.1-32.el9_9.1.rocky.0.1               appstream
nginx.x86_64               2:1.20.1-32.el9_9.2.rocky.0.1               appstream

Without --showduplicates, yum shows only the newest, which is why people fail to install specific version builds that are right there in the repo. The version column is epoch:version-release. The epoch (2: here, 1: on Rocky 8) is part of the version and wins over everything else when versions are compared, so keep it when you copy the string.

Step 2: install specific version with the full NEVRA

$ yum -y install nginx-2:1.20.1-32.el9_9.1.rocky.0.1
$ rpm -q nginx
nginx-1.20.1-32.el9_9.1.rocky.0.1.x86_64

The form is name-[epoch:]version-release, optionally followed by .arch. Other spellings fail:

$ yum -y install nginx=2:1.20.1-32.el9_9.1.rocky.0.1
Error: Unable to find a match: nginx=2:1.20.1-32.el9_9.1.rocky.0.1
$ yum -y install nginx-9.99
Error: Unable to find a match: nginx-9.99

The = syntax belongs to apt, not yum. A partial version works, but it picks the newest match: yum install 'nginx-2:1.20.1' installed release .2, not .1. If you need an exact build, give the full release.

The trap on EL8 and EL9: module streams

Install specific version with yum on Rocky 8: nginx 1.24.0 is not found until the module stream nginx:1.24 is enabled
Lab: Rocky 8.10, the same request before and after enabling the stream.

On Rocky 8, --showduplicates listed exactly one nginx, 1.14.1. Yet the repository has much newer ones:

$ yum -q module list nginx
Name  Stream   Profiles   Summary
nginx 1.14 [d] common [d] nginx webserver
nginx 1.16     common [d] nginx webserver
nginx 1.18     common [d] nginx webserver
nginx 1.20     common [d] nginx webserver
nginx 1.22     common [d] nginx webserver
nginx 1.24     common [d] nginx webserver

This is the most common reason you cannot install specific version numbers on EL8. Each stream is a separate set of versions, and yum only shows the enabled one (1.14 is the default, marked [d]). Asking for a version from another stream fails with the same "no match" error as a version that does not exist:

$ yum -y install nginx-1.24.0
Error: Unable to find a match: nginx-1.24.0
$ yum -y module enable nginx:1.24
$ yum -q --showduplicates list nginx | grep ^nginx
nginx.x86_64        1:1.24.0-1.module+el8.10.0+1665+a6c695b5           appstream
nginx.x86_64        1:1.24.0-2.module+el8.10.0+40137+188e04f4          appstream
...
nginx.x86_64        1:1.24.0-3.module+el8.10.0+40469+da1f451a.9        appstream
$ yum -y install nginx-1.24.0; rpm -q nginx
nginx-1.24.0-3.module+el8.10.0+40469+da1f451a.9.x86_64

Once the 1.24 stream was enabled, the version list contained ten 1.24.0 builds and the install worked. Moving between streams of an installed package is a separate command, and it locks you to the new stream:

$ yum -y module switch-to nginx:1.22; rpm -q nginx
nginx-1.22.1-2.module+el8.10.0+1540+8eca54a7.x86_64
$ yum -y install nginx-1.24.0
Error: Unable to find a match: nginx-1.24.0

Rocky 9 has module streams too (nginx 1.22, 1.24 and 1.26 in my run) next to the non-modular 1.20.1 in AppStream. So when a version you know exists is "not found", check yum module list <package> before anything else.

Install specific version from a specific repo

When the same package exists in several repositories, you can limit the search. --repo (or the older --disablerepo="*" --enablerepo=...) works for listing:

$ yum -q --showduplicates list nginx --repo appstream | grep ^nginx
nginx.x86_64               2:1.20.1-32.el9_9.1.rocky.0.1               appstream
nginx.x86_64               2:1.20.1-32.el9_9.2.rocky.0.1               appstream
$ yum -q --showduplicates list nginx --repo baseos
Error: No matching Packages to list

But be careful when you install specific version builds this way. --repo limits the dependencies too:

$ yum -y install --repo appstream nginx-2:1.20.1-32.el9_9.1.rocky.0.1
 Problem: conflicting requests
  - nothing provides systemd needed by nginx-2:1.20.1-32.el9_9.1.rocky.0.1.x86_64 from appstream

systemd lives in BaseOS, which the option had just switched off. Use --repo to look, and the full NEVRA to choose; the NEVRA already pins the exact build, whichever repository provides it.

Going back to an older version

To install specific version builds that are older than what you have, installing the older NEVRA on top of the newer one is enough; yum turns it into a downgrade. On Rocky 9, from .2 back to .1:

$ yum -y install nginx-2:1.20.1-32.el9_9.1.rocky.0.1; rpm -q nginx
nginx-1.20.1-32.el9_9.1.rocky.0.1.x86_64

yum downgrade <nevra> does the same with a clearer intent. Note that dependencies such as nginx-core and nginx-filesystem moved with it. For a deeper look at downgrades, rollbacks and yum history, see yum downgrade, upgrade and rollback.

Keep the version: versionlock

After you install specific version packages, the next yum update will undo your choice unless you lock it. The plugin is a separate package:

$ yum -y install python3-dnf-plugin-versionlock
$ yum versionlock add nginx
Adding versionlock on: nginx-2:1.20.1-32.el9_9.1.rocky.0.1.*
$ yum -y update nginx
Dependencies resolved.
Nothing to do.
Complete!
$ yum versionlock delete nginx; yum -y update nginx; rpm -q nginx
Deleting versionlock for: nginx-2:1.20.1-32.el9_9.1.rocky.0.1.*
nginx-1.20.1-32.el9_9.2.rocky.0.1.x86_64

With the lock, a newer build was available and update said "Nothing to do". After deleting the lock, the same command upgraded to .2. A versionlock also blocks security updates for that package, so write down why you locked it and when you plan to remove the lock.

Check what you installed

$ rpm -q --qf "%{NAME} epoch=%{EPOCHNUM} version=%{VERSION} release=%{RELEASE} arch=%{ARCH}\n" nginx
nginx epoch=2 version=1.20.1 release=32.el9_9.2.rocky.0.1 arch=x86_64
$ yum -q info nginx | grep -E "^(Name|Epoch|Version|Release|Repository|From repo)"
Name         : nginx
Epoch        : 2
Version      : 1.20.1
Release      : 32.el9_9.2.rocky.0.1
Repository   : @System
From repo    : appstream

rpm -q hides the epoch by default; the query format shows it.

Checklist to install specific version packages

  1. yum --showduplicates list <pkg> to see versions in enabled repos and streams.
  2. Not listed? yum module list <pkg>, then yum module enable <pkg>:<stream>.
  3. Install with name-epoch:version-release, never name=version.
  4. Lock it with yum versionlock add if updates must not move it.
  5. Verify with rpm -q --qf including the epoch.

If an install leaves dependencies in a bad state, the post on repairing broken packages helps. All options are in the dnf command reference, which is what yum runs on every current RHEL-family system when you install specific version packages.

Comments

Popular posts from this blog

How to Play Minecraft Bedrock Edition on Linux: A Comprehensive Guide for Tech Professionals

Linux desktop frozen? My 5 go-to tricks to try - before forcing a hard reboot

The Ultimate Guide: How to Set Up DXVK in Wine on Linux for Enhanced Gaming Performance