How to install a specific version of RPM from different versions using YUM ?

In this article, we will look how to install a specific version of a software when we have multiple versions available through repositories.

This is very useful tip to work on Linux servers.

Lets have a look step by step.

1. First search your package using grep

[root@ngelinux01 tmp]# yum list all | grep -i java-
java-1.8.0-openjdk.x86_64 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-headless.x86_64
abrt-java-connector.x86_64 1.0.6-12.el7 rhel-7-server-rpms
java-1.6.0-openjdk.x86_64 1:1.6.0.41-1.13.13.1.el7_3
java-1.6.0-openjdk-demo.x86_64 1:1.6.0.41-1.13.13.1.el7_3
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el7_3
java-1.6.0-openjdk-javadoc.x86_64
java-1.6.0-openjdk-src.x86_64 1:1.6.0.41-1.13.13.1.el7_3
java-1.7.0-openjdk.x86_64 1:1.7.0.261-2.6.22.2.el7_8
java-1.7.0-openjdk-accessibility.x86_64
java-1.7.0-openjdk-demo.x86_64 1:1.7.0.261-2.6.22.2.el7_8
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.261-2.6.22.2.el7_8
java-1.7.0-openjdk-headless.x86_64
java-1.7.0-openjdk-javadoc.noarch
java-1.7.0-openjdk-src.x86_64 1:1.7.0.261-2.6.22.2.el7_8
java-1.8.0-openjdk.i686 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-accessibility.i686
java-1.8.0-openjdk-accessibility.x86_64
java-1.8.0-openjdk-accessibility-debug.i686
java-1.8.0-openjdk-accessibility-debug.x86_64
java-1.8.0-openjdk-debug.i686 1:1.8.0.242.b08-0.el7_7
java-1.8.0-openjdk-debug.x86_64 1:1.8.0.242.b08-0.el7_7
java-1.8.0-openjdk-demo.i686 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-demo.x86_64 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-demo-debug.i686
java-1.8.0-openjdk-demo-debug.x86_64
java-1.8.0-openjdk-devel.i686 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-devel-debug.i686
java-1.8.0-openjdk-devel-debug.x86_64
java-1.8.0-openjdk-headless.i686 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-headless-debug.i686
java-1.8.0-openjdk-headless-debug.x86_64
java-1.8.0-openjdk-javadoc.noarch
java-1.8.0-openjdk-javadoc-debug.noarch
java-1.8.0-openjdk-javadoc-zip.noarch
java-1.8.0-openjdk-javadoc-zip-debug.noarch
java-1.8.0-openjdk-src.i686 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-src.x86_64 1:1.8.0.282.b08-1.el7_9
java-1.8.0-openjdk-src-debug.i686
java-1.8.0-openjdk-src-debug.x86_64
java-11-openjdk.i686 1:11.0.10.0.9-0.el7_9
java-11-openjdk.x86_64 1:11.0.10.0.9-0.el7_9
java-11-openjdk-debug.i686 1:11.0.6.10-1.el7_7 rhel-7-server-optional-rpms
java-11-openjdk-debug.x86_64 1:11.0.6.10-1.el7_7 rhel-7-server-optional-rpms
java-11-openjdk-demo.i686 1:11.0.10.0.9-0.el7_9
java-11-openjdk-demo.x86_64 1:11.0.10.0.9-0.el7_9
java-11-openjdk-demo-debug.i686 1:11.0.6.10-1.el7_7 rhel-7-server-optional-rpms
java-11-openjdk-demo-debug.x86_64
java-11-openjdk-devel.i686 1:11.0.10.0.9-0.el7_9
java-11-openjdk-devel.x86_64 1:11.0.10.0.9-0.el7_9
java-11-openjdk-devel-debug.i686 1:11.0.6.10-1.el7_7 rhel-7-server-optional-rpms
java-11-openjdk-devel-debug.x86_64
java-11-openjdk-headless.i686 1:11.0.10.0.9-0.el7_9
java-11-openjdk-headless.x86_64 1:11.0.10.0.9-0.el7_9
java-11-openjdk-headless-debug.i686
java-11-openjdk-headless-debug.x86_64
java-11-openjdk-javadoc.i686 1:11.0.10.0.9-0.el7_9
java-11-openjdk-javadoc.x86_64 1:11.0.10.0.9-0.el7_9
java-11-openjdk-javadoc-debug.i686
java-11-openjdk-javadoc-debug.x86_64
java-11-openjdk-javadoc-zip.i686 1:11.0.10.0.9-0.el7_9

 

2. Now install the package by specifying the version in below format.
# yum install <Name-version.arch>

[root@ngelinux01 tmp]# yum install java-1.8.0-openjdk.x86_64
Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos,
: subscription-manager
rhel-7-server-ansible-2.8-rpms | 2.3 kB 00:00:00
rhel-7-server-extras-rpms | 2.0 kB 00:00:00
rhel-7-server-optional-rpms | 1.8 kB 00:00:00
rhel-7-server-rpms | 2.0 kB 00:00:00
rhel-7-server-satellite-tools-6.5-rpms | 2.1 kB 00:00:00
rhel-7-server-thirdparty-oracle-java-rpms | 1.7 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.282.b08-1.el7_9 will be installed
--> Processing Dependency: java-1.8.0-openjdk-headless(x86-64) = 1:1.8.0.282.b08-1.el7_9 

The trick here is to understand how to mention the package name of desired version.

Once we get that, we can easily install the package with specific version.

Leave a Reply

Your email address will not be published.