Yum: Install a Specific Version of Package on Linux Device

yum install specific version

yum install specific versionYum is the package manager of choice in most Linux based operating systems, especially CentOS and RedHat systems. Since CentOS is approaching EOL shortly, the official migration platform proposed by CentOS is to RedHat Enterprise Linux (RHEL). Both of these platforms use Yum as their package manager. Did you know that in Yum, installing specific version of package is possible?

Yum is a popular way to manage software installation, update, and removal. Installing a package with Yum is very simple. The basic syntax to install a package with Yum is:
yum install unixmen_package

There may be cases where a particular package might not be sufficient. You may need a specific version of a package to be installed. In these cases, Yum is still your helpful package manager and can get things done. Let us learn how.

Why You Might Need the Specific Version of a Package

We have already covered the basics of Yum command. Now it is important to understand the need in Yum to install a specific version of a package.

  • Device Compatibility: If you manage multiple devices running on different operating systems or flavors, you might be aware that one version of a package will not work on all systems. At the time of publishing this article, people in the tech community are checking compatibility of their devices with the latest Windows Server 2025 GA release because a lot of the running applications are not compatible with the latest version yet. In Linux, some applications may require stringent dependency on versions of Libraries. Newer or older versions might break functionality.
  • Rollback: If an updated version of a package causes problems, the earlier stable version has to be applied immediately to ensure seamless operations. At this point of time, you can use Yum to install specific versions of the application.
  • Product compatibility: If your tool has to be rolled out to general availability, it has to be tested with a wide range of versions of dependent packages. During testing, it becomes important in Yum to install a specific version of a package.

How Yum Operates Package Versions

Yum (a.k.a. Yellowdog Updater Modified) is a prominent package manager that brings software packages from pre-configured repositories. For example, let’s say you have run the command:

yum install unixmen_mediaplayer

Yum fetches the latest available version from its repositories by default. For example, if version 18.0 is the latest available version of Unixmen media player, by default, version 18.0 will be installed. But what if your hardware supports only until version 17.5? With a few modifications, yum lets you install specific versions you need, if it is available in repositories.

Things to Note Before Installing Specific Versions

  • The version of package you want to install should be available in the repositories configured for your system
  • If the version you want is unavailable in the repository, you may need to add or configure a different repository.
  • Yum provides options to list, install, and downgrade packages depending on your requirements.

Required Conditions Before You Proceed

To ensure optimal installation of specific package version via Yum, make sure

  • You have root or sudo privileges
    Your system has package repositories properly setup
  • How to Use Yum to Install Specific Version of Package
    Here are the step-by-step instructions to install a specific version of the package using Yum.

Step 1: View the List of All Available Versions of a Package

Before installing a specific version, it is important to check the list of versions that are available. To view the list of versions available, run the command:

sudo yum --showduplicates list NameOfPackage

Replace “NameOfPackage” with the name of the package you want to install. For example, if you would like to see the list of available versions of the httpd package, run the command:

sudo yum --showduplicates list httpd

The output will look similar to this, with the list of all available versions of the httpd package from your repositories.

Loaded plugins: unixmen
Loading mirror speeds from cached hostfile
* base: mirror.unixmen.com
* extras: mirror.unixmen.com
* updates: mirror.unixmen.com
Available Packages
httpd.x86_64 2.4.6-90.el7.centos base
httpd.x86_64 2.4.6-93.el7.centos updates

In the above example, you could see that there are only two available versions of httpd: 2.4.6-90.el7.centos and 2.4.6-93.el7.centos.

Installing the Specific Version of Package

Once you see the version you want listed in the output of the previous command, it is now time to install. Here is how in Yum you can install a specific version of a package:

sudo yum install NameOfPackage-version

For better clarity, let us use the same example from step 1. If you would like to install the version 2.4.6-90.el7.centos of httpd, execute the command:

sudo yum install httpd-2.4.6-90.el7.centos

This command will install the specific version of the package, since we have already confirmed that it is available in the configured repositories.

Step 3: Making Sure the Correct Version is installed

There is a very low probability that the version we specified is not installed. Reasons for that can include network connectivity issues or permission issues. To ensure if the correct version is installed, you can check the package version by executing the command:

rpm -qi NameOfPackage

Again, for better clarity, let us take the example mentioned in step 1. If you execute this command, the output must mention 2.4.6-90.el7.centos:

rpm -qi httpd

If the output matches with the version number we intended to install, it means the installation was successful.

Disadvantages of Installing Specific Version of Package

  • Maintenance: Manually managing package versions is too much work and it is preferred that all devices run on the same version of the package.
  • Dependency Issues: Some applications may have issues with mismatched library versions
  • Security concerns: Updates often contain security patches against vulnerabilities. Downgrading an application exposes your system to vulnerabilities.

Wrapping Up

You may have read our article about the Yum install command. The Yum install command is powerful and versatile. The Yum install specific version command is equally helpful and powerful in catering to your environment’s needs. By following this guide, you can install the exact version of the package you want to run on your device.

Related Link

Yum Command Cheat Sheet for Red Hat Enterprise Linux – Red Hat Customer Portal