CentOS / RHEL : How to install a specific version of rpm package using YUM

Question : How to install a specific rpm package version using yum?

Answer :

The ask here is to install a specific version of the package when multiple versions are available. By default when you do not specify a version for a package, latest version gets installed. The procedure below requires you to be logged in as root.

1. clean the yum cache directory

# yum clean all

2. To install a specific version of a package we must know the available package version in our repository. List all the version of the packages available :

# yum --showduplicate list [package_name]

For Example :

# yum --showduplicate list firefox
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Available Packages
firefox.x86_64                                                              24.5.0-1.el7                                                                RHEL7
firefox.x86_64                                                              24.6.0-1.el7_0                                                              RHEL7
firefox.x86_64                                                              24.7.0-1.el7_0                                                              RHEL7
firefox.x86_64                                                              24.8.0-1.el7_0                                                              RHEL7
firefox.x86_64                                                              31.1.0-6.el7_0                                                              RHEL7
firefox.x86_64                                                              31.2.0-3.el7_0                                                              RHEL7
firefox.x86_64                                                              31.3.0-3.el7_0                                                              RHEL7
firefox.x86_64                                                              31.4.0-1.el7_0                                                              RHEL7
firefox.x86_64                                                              31.5.0-2.el7_0                                                              RHEL7
firefox.x86_64                                                              31.5.3-3.el7_1                                                              RHEL7
firefox.x86_64                                                              31.6.0-2.el7_1                                                              RHEL7
firefox.x86_64                                                              38.0-3.el7_1                                                                RHEL7
firefox.x86_64                                                              38.0.1-1.el7_1                                                              RHEL7
.....

3. Install the specific version of the firefox package using the version number in the second column.
Syntax :

# yum install [package-name]-[version].[architecture]

For example :

# yum install firefox-31.5.3-3.el7_1.x86_64
Related Post