How to restrict yum to install or upgrade a package to a fixed specific package version?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5, 6, 7

Issue

  • How to restrict yum to install or upgrade a package to a specific version only?
  • How to restrict yum to install or upgrade a package to a fixed specific version and not to a later version than specified.
  • How to lock the package to the specific version from update?
  • What is yum versionlock ?

Resolution

You can restrict yum to install or upgrade a package to a fixed specific version and not to a later version than specified using the versionlock plugin of yum.

To do this, follow:

  1. Install package named yum-plugin-versionlock (called yum-versionlock in RHEL 5).

    # yum install yum-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 package, add that package name to the /etc/yum/pluginconf.d/versionlock.list file by running:

    # yum versionlock gcc-*
    

    (Alternatively, you can edit the filelist, /etc/yum/pluginconf.d/versionlock.list, directly.)

  • The above configuration will not allow to upgrade the gcc package to version greater than what was installed at the time the locking was performed.
  • Yum will attempt to update all packages, while excluding the packages listed in the versionlock file.

Other Commands

To display the list, use:

# yum versionlock list

To discards the list, use:

# yum versionlock clear

Additional Information

See the yum-versionlock(1) for a list of all available commands.

  • Component
  • yum

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.