CentOS / RHEL: Yum Lock Package Version At a Particular Version

In CentOS/RHEL, you can use the yum versionlock plugin to lock a package version at a particular version. This will prevent the package from being upgraded, even if a newer version is available in the repository.

Here’s how you can lock a package version:

  1. Install the yum-versionlock plugin:
yum install yum-plugin-versionlock
  1. Find the package and version you want to lock:
yum list <package_name>
  1. Lock the package version:
yum versionlock <package_name>-<version>

Replace <package_name> and <version> with the name and version of the package you want to lock. For example, to lock the version of the httpd package to 2.4.6:

yum versionlock httpd-2.4.6

Once the package version is locked, you can run yum update as usual and the locked package version will not be upgraded. To view the list of locked packages, use the following command:

yum versionlock list

To remove a version lock, you can use the following command:

yum versionlock delete <package_name>-<version>

It is important to regularly check for and install security updates, even if a package version is locked. Locking a package version should only be done in specific cases where upgrading the package would cause compatibility issues.

Leave a Comment