How to Install Specific Version of Package on CentOS & RHEL 7

How to Install Specific Version of Package on CentOS & RHEL 7

Sometimes, you may need to have a certain version of a package installed on your system to conform to a certain requirement.

In this article, we are going to see how we can install specific versions of packages using yum package manager in Centos  & RHEL 7.

First, we need to know the available versions for a particular package.

Step 1: Check available versions

In this example, we are going to list the available versions of samba in your enabled repositories for RHEL 7 system.

Login as root and run the command below

yum --showduplicates list samba

Sample Output

Loaded plugins: amazon-id, rhui-lb, search-disabled-repos

Available Packages

samba.x86_64              4.1.1-31.el7                   rhui-REGION-rhel-server-releases

samba.x86_64              4.1.1-33.el7_0                 rhui-REGION-rhel-server-releases

samba.x86_64              4.1.1-35.el7_0                 rhui-REGION-rhel-server-releases

samba.x86_64              4.1.1-37.el7_0                 rhui-REGION-rhel-server-releases

samba.x86_64              4.1.1-38.el7_0                 rhui-REGION-rhel-server-releases

samba.x86_64              4.1.12-21.el7_1                rhui-REGION-rhel-server-releases

samba.x86_64              4.1.12-23.el7_1                rhui-REGION-rhel-server-releases

samba.x86_64              4.1.12-24.el7_1                rhui-REGION-rhel-server-releases

samba.x86_64              4.2.3-10.el7                   rhui-REGION-rhel-server-releases

samba.x86_64              4.2.3-11.el7_2                 rhui-REGION-rhel-server-releases

samba.x86_64              4.2.3-12.el7_2                 rhui-REGION-rhel-server-releases

samba.x86_64              4.2.10-6.el7_2                 rhui-REGION-rhel-server-releases

Since Yum uses the RPM package manager for handling packages, the package names are based on the RPM package label format.

Step 2: Install a Specific version of a package

Now we can proceed and install any version of the samba package.

To do this, run we are going to append the version of the package at the end. i.e

yum install <packagename> <version>

To install the version which is samba.x86_64 4.2.3-10.el7  according to our output as displayed earlier, run the command below

yum install samba-4.2.3-10

If you want to be more specific, you can include the version release as shown

yum install samba-4.2.3-10.el7_2

Important: Sometimes, If you don’t set specific version of dependences, yum will take the latest version automatically.

That may cause a big problem, eg. Mariadb-server is 5.6 but Mariadb-client is 5.7

so make sure to install dependences with the same version as the main package

Leave a Reply

Your email address will not be published. Required fields are marked *