How to Install a Specific Version of RPM Package Using YUM?

YUM is a package manager utilized to install, remove and update RPM packages on a CentOS system. It can also automatically resolve dependencies, making managing software on the system easier. These packages contain the software files, as well as metadata regarding the package, like dependencies and version numbers. 

This article will explain the step-by-step instructions to install the specific version of the RPM package using YUM. 

How to Install a Specific Version of RPM Package Using YUM?

The steps here show the installation of a specific version of RPM packages. 

Step 1: Search the Specific Version of the Package

Before installing a specific version of the rpm package, it is good practice to check the available packages. For this, the “yum” command is utilized with the “grep” by specifying the package name as “zlib”: 

$ yum list all | grep -i zlib

The output shows all the available packages associated with the “zlib”. We will install the “zlib-devel” package having architecture “x86_64”.

Step 2: Install the Specific Version of an RPM Package

To install a specific RPM package, use the YUM package manager on a CentOS system. The basic syntax of installing the specific package is mentioned below:

Syntax:

$ sudo yum install <package-name>-<version>

In our case, install the “zlib-devel” package having architecture “x86_64” in the following command:

$ sudo yum install zlib-devel.x86_64

The output shows that the “zlib-devel” package of the “1.2.7-20.el7_9” version has been installed in the system.

How to Forcefully Install a Specific Version of RPM Package? 

Users can forcefully install a specific package version and its dependencies by utilizing the “skip-broken” utility. For instance, specify the specific “java-1.8.0-openjdk.x86_64” package for installation:

$ sudo yum install java-1.8.0-openjdk.x86_64 --skip-broken

The output shows that the “java-1.8.0-openjdk.x86_64” package has been installed in the system.

How to Upgrade a Specific Version of the RPM Package?

To upgrade a package to a specific version, utilize the “update” command in the following command:

# yum update python3-3.6.8-18.el7.x86_64

The output shows that the specific package “python3-3.6.8-18.el7.x86_64” has been upgraded.

How to Downgrade a Specific Version of RPM Package?

For downgrading a specific package version, use the “downgrade” option by specifying the package name. In our case, specify the package name “java-1.8.0-openjdk.x86_64” to downgrade using the following command:

# yum downgrade java-1.8.0-openjdk.x86_64

The output shows that the “java-1.8.0-openjdk.x86_64” has been successfully downgraded.

How to Remove a Specific Version of RPM Packages Using YUM?

To remove the specific version of RPM packages using YUM, specify the package name. For instance, execute the “java-1.8.0-openjdk.x86_64” package with the “remove” utility as below:

$ sudo yum remove java-1.8.0-openjdk.x86_64

The output shows that the “java-1.8.0-openjdk.x86_64” package has been removed from the system.

Conclusion

In CentOS, the command “yum install <package-name>-<version>” can be followed to install a specific version of the RPM package. Users must specify the “package name” and the “version” for this. This post briefly explained installing a specific RPM package version using YUM alongside upgrading, downgrading, and removing. 

Over 500 Million Views on Our Blogs and YouTube! We’re inviting 10 businesses to partner with us and grow together. Click here to join us! ×