Environment
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
Issue
- Lock a package to a specific version only, and no later
- Exclude a package from
$ yum update - What is
yum versionlock?
Resolution
-
Install package
For RHEL 5 # yum install yum-versionlock For RHEL 6 and 7 # yum install yum-plugin-versionlock For RHEL 8 and 9 # yum install python3-dnf-plugin-versionlockThe
/etc/yum/pluginconf.d/versionlock.listwill be created on the system. -
To install or lock the version of the
gccgroup of packages, run# yum versionlock gcc-*
Root Cause
Use the yum versionlock plugin to lock a package or packages to currently installed version. The plugin stores a package list in `/etc/yum/pluginconf.d/versionlock.list, which you can edit directly. Yum will normally attempt to update all packages, but the plugin will exclude the packages listed in the versionlock.list file.
The above configuration will not allow yum update or yum upgrade to update any of the gcc packages to version greater than what was installed at the time the locking was performed.
See the yum-versionlock(1) for a list of all available commands.
Diagnostic Steps
-
To display the list of locked packages, use:
# yum versionlock list -
To discard the list of locked packages, use:
# yum versionlock clear