How to Install Specific Version of Package using DNF
Abstract: we learned how to install specific package using the DNF package manager in RHEL based Linux distributions.dnf --showduplicates list To list all avail
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 versionsTo 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
![](https://img.xtech01.com/content/00/040/40327-1.jpg)
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 DNFOnce 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.
ConclusionIn this tutorial, we learned how to install specific package using the DNF package manager in RHEL based Linux distributions.