fbpx

Server Setup

CentOS/RHEL 8: How to prevent a package from upgrading?

by ,


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

Environment

CentOS/RHEL 8

Issue

  • How to restrict yum (dnf) 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 dnf versionlock ?

Resolution

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

To do this, follow:

1. Install package named python3-dnf-plugin-versionlock :

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

dnf  versionlock gcc-*

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

The above configuration will not allow upgrading the gcc package to a version greater than what was installed at the time the locking was performed.

DNF will attempt to update all packages while excluding the packages listed in the version lock file.

Other Commands

To display the list, use:

dnf versionlock list

To discards the list, use:

dnf versionlock clear

Additional Information

See man dnf.plugin.versionlock for a list of all available commands.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.