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

w‮ttual.ww‬uri.com
CentOS / RHEL: Yum Lock Package Version At a Particular Version

To lock a package at a particular version using the yum package manager on CentOS or RHEL, you can use the following steps:

  1. Install the yum-versionlock plugin, which allows you to lock package versions in yum. You can do this by running the following command:
sudo yum install yum-plugin-versionlock
  1. Lock the desired package at a particular version by running the yum versionlock command followed by the name and version of the package. For example, to lock the package_name package at version 1.2.3:
sudo yum versionlock package_name-1.2.3

This will add the package and version to the version lock list, which prevents yum from updating or removing the package.

  1. To view the current version lock list, you can use the yum versionlock list command. This will display a list of the packages and versions that are currently locked.

  2. To remove a package from the version lock list, you can use the yum versionlock delete command followed by the name of the package. For example:

sudo yum versionlock delete package_name

This will remove the package from the version lock list and allow yum to update or remove the package as needed.

Note: The yum-versionlock plugin only applies to the yum package manager. It does not prevent other package managers, such as dnf, from updating or removing the package. If you want to prevent a package from being updated or removed by all package managers on your system, you can use the yum install command with the --setopt=protected_packages=package_name option to mark the package as protected. For example:

sudo yum install --setopt=protected_packages=package_name package_name

This will mark the package as protected and prevent all package managers from updating or removing the package. To view the list of protected packages, you can use the yum list --protection command.

Created Time:2017-10-16 14:38:41  Author:lautturi