Updated: 8 October 2026 · Applies to: AlmaLinux 10.2 (dnf 4.20.0), AlmaLinux 9.8 (dnf 4.14.0), Rocky Linux 9.8 and 10.2, Fedora 44 (dnf5 5.4.3)

To install a specific package version on AlmaLinux, Rocky Linux, RHEL or Fedora, list the versions with dnf list --showduplicates, then install name-version-release from that list. Lock it with dnf versionlock so the next update does not replace it:

dnf list --showduplicates nginx
sudo dnf install nginx-1.26.3-6.el10_2.6
sudo dnf versionlock add nginx

The examples use nginx on AlmaLinux 10; the commands are the same for any package. For Ubuntu and Debian (apt), see how to install a specific package version with apt.

1. List every available version

$ dnf list --showduplicates nginx
Available Packages
nginx.x86_64                    2:1.26.3-6.el10_2.3                    appstream
nginx.x86_64                    2:1.26.3-6.el10_2.4                    appstream
nginx.x86_64                    2:1.26.3-6.el10_2.5                    appstream
nginx.x86_64                    2:1.26.3-6.el10_2.6                    appstream
nginx.x86_64                    2:1.26.3-6.el10_2.7                    appstream

The middle column is epoch:version-release. Here the epoch is 2, the version 1.26.3 and the release 6.el10_2.6. Rocky Linux 10.2 listed the same five builds. Fedora keeps far fewer, only the release version and the latest update. Its dnf5 also wants the option after list; dnf --showduplicates list nginx failed there with Unknown argument "--showduplicates" for command "dnf5".

$ dnf list --showduplicates nginx
Available packages
nginx.x86_64 2:1.28.2-1.fc44 fedora
nginx.x86_64 2:1.30.5-1.fc44 updates

2. Install a specific version

Join the name, version and release with hyphens. You can leave out the epoch:

$ sudo dnf install nginx-1.26.3-6.el10_2.6
Installed:
  almalinux-logos-httpd-100.4-1.el10_2.noarch
  logrotate-3.22.0-5.el10.x86_64
  nginx-2:1.26.3-6.el10_2.6.x86_64
  nginx-core-2:1.26.3-6.el10_2.6.x86_64
  nginx-filesystem-2:1.26.3-6.el10_2.6.noarch

dnf picked the matching nginx-core and nginx-filesystem by itself. A version that is not in the repositories fails with Error: Unable to find a match: nginx-9.9.9.

3. Downgrade

The old trick of removing the package first is not needed. Installing an older version replaces the newer one, and the summary says Downgraded:

$ sudo dnf install nginx-1.26.3-6.el10_2.3
Downgraded:
  nginx-2:1.26.3-6.el10_2.3.x86_64
  nginx-core-2:1.26.3-6.el10_2.3.x86_64
  nginx-filesystem-2:1.26.3-6.el10_2.3.noarch

sudo dnf downgrade nginx goes back one version instead (it moved el10_2.7 to el10_2.6). On the oldest available version, Fedora 44 replied The lowest available version of the "nginx.x86_64" package is already installed, cannot downgrade it. Take a backup first: database servers in particular may not read data that a newer version has already converted.

4. Lock the version

On AlmaLinux, Rocky Linux and RHEL, versionlock is a plugin:

$ sudo dnf install python3-dnf-plugin-versionlock
$ sudo dnf versionlock add nginx
Adding versionlock on: nginx-2:1.26.3-6.el10_2.7.*
$ sudo dnf upgrade nginx
Dependencies resolved.
Nothing to do.

dnf versionlock list shows the locks and dnf versionlock delete nginx removes one. dnf versionlock exclude nginx-1.26.3-6.el10_2.7 does the opposite: it blocks just that version (the list shows it with a !). In Fedora's dnf5, versionlock is built in and the output looks different:

$ sudo dnf versionlock add nginx
Adding versionlock on "nginx = 2:1.28.2-1.fc44".

A locked package gets no security updates, so lock only for a reason and review it. Other ways to hold packages back are in ways to lock or exclude package updates with dnf.

5. Undo a change with dnf history

$ dnf history list | head -4
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     6 | downgrade -y nginx       | 2026-10-08 07:25 | Downgrade      |    3
     5 | upgrade -y nginx         | 2026-10-08 07:25 | Upgrade        |    3

sudo dnf history undo last reverted that downgrade and put el10_2.7 back. To undo an older transaction, give its ID instead of last, according to the dnf manual. dnf downloads the previous packages again, so undo works only while they are still in the repositories. More in how to use dnf history.

6. Module streams (RHEL 9 family only)

On AlmaLinux and Rocky Linux 9, some software comes in module streams, one per major version. Their packages stay hidden until you enable a stream:

$ dnf module list nginx
Name  Stream Profiles   Summary
nginx 1.22   common [d] nginx webserver
nginx 1.24   common [d] nginx webserver
nginx 1.26   common [d] nginx webserver
$ sudo dnf module enable nginx:1.24
$ sudo dnf install nginx
$ nginx -v
nginx version: nginx/1.24.0

Before the stream was enabled, dnf list --showduplicates nginx offered only 1.20.1 builds. sudo dnf module switch-to nginx:1.26 moved the installed packages to 1.26.3, and sudo dnf module reset nginx forgets the choice. RHEL 10 ships no modular content, according to Red Hat: on AlmaLinux 10, dnf module list printed only WARNING: modularity is deprecated, and Fedora 44 listed no modules either.

7. What changed from yum

  • On AlmaLinux 9 and 10, yum is a link to dnf (/usr/bin/yum -> dnf-3), so old commands such as yum --showduplicates list nginx still work. On Fedora 44 both names point to dnf5, which is stricter about option order (see step 1).
  • The yum versionlock plugin is now python3-dnf-plugin-versionlock; dnf5 has it built in.
  • yum-utils commands moved into dnf subcommands: see yum-utils on RHEL, AlmaLinux and Rocky Linux 9 and 10.

Ucartz services for this topic

Was this answer helpful? 1 Users Found This Useful (1 Votes)