To lock a package at a particular version using the yum
package manager on CentOS or RHEL, you can use the following steps:
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
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.
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.
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 theyum
package manager. It does not prevent other package managers, such asdnf
, 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 theyum 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.