Site icon GetPageSpeed

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

Linux Command Line

Linux Command Line

Environment

CentOS/RHEL 8

Issue

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.

Exit mobile version