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.