Restricting a Package to a Fixed Version Number with yum


  • 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


  • Lock a package to a specific version only, and no later
  • Exclude a package from $ yum update
  • What is yum versionlock?


  1. 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-versionlock

    The /etc/yum/pluginconf.d/versionlock.list will be created on the system.

  2. To install or lock the version of the gcc group 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


Article Details

Article ID:
Rating (Votes):

NodeSpace Hosting