RedHat OS Family
Add lock
sudo yum install yum-plugin-versionlock
The /etc/yum/pluginconf.d/versionlock.list will be created on the system.- 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:
sudo yum versionlock gcc-*
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.
List locks
yum versionlock list
Remove lock
yum versionlock clear
Debian OS Family
tbd