How to Install Specific Version of Package using DNF

Last updated: June 26, 2022

As part of application requirements or testing, you might need to install specific version of a package. DNF is a package manager for RPM-based Linux distributions such Fedora, RHEL, Rocky Linux, AlmaLinux, and more.

In this tutorial, we learn how to install specific version of package using DNF.

DNF List all avaiable package versions

To list all available package versions for the current release, type:

dnf --showduplicates list

To list all available versions of a specific package, type:

dnf --showduplicates list samba
dnf list all available versions of a specific package

The output display in the following format:

package_name.architecture  version_number–build_number  repository

You can the available package versions and which version is already been installed.

Install specific version of a package using DNF

Once you find the specific version for the package to install, use the dnf command as follows:

sudo dnf install samba-4.15.7-0.fc35

This will download and install the specific samba version ( ie samba-4.15.7-0.fc35).

An alternative option to install an older package version is to use dnf downgrade command, assuming you have a newer version installed.

For example

dnf downgrade package-name+version

This will downgrade the installed version to the older package version along with all the dependencies ( assuming the old package available in the repo).

If the package is not available in the repository, you can search and download rpm package from Koji.

dnf downgrade path/to/package.rpm


dnf install path/to/package.rpm

You need to keep remember that when you run dnf upgrade or update command the package will get updated with the new version which is available in the repository.


In this tutorial, we learned how to install specific package using the DNF package manager in RHEL based Linux distributions.

About The Author

Bobbin Zachariah

Bobbin Zachariah

Bobbin started his career in IT in the year 2000 as a computer science instructor and worked as a Linux system engineer and senior analyst roles. Currently working in DevOps environments to increase efficiency and improve delivery time in AWS Cloud infrastructure. He is certified in RHEL, CCNA, and MCP and holds a Masters's in computer science. When in his free time love playing cricket, blogging, and listening to music.



Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment