How to Install Specific Version of Package using DNF

Written by: Bobbin Zachariah   |   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

or

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.

Conclusion

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 Zachariah is an experienced Linux engineer who has been supporting infrastructure for many companies. He specializes in Shell scripting, AWS Cloud, JavaScript, and Nodejs. He has qualified Master’s degree in computer science. He holds Red Hat Certified Engineer (RHCE) certification and RedHat Enable Sysadmin.

SHARE

Comments

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

Leave a Reply

Leave a Comment