To protect the packages in a Yum repository on a CentOS or Red Hat Enterprise Linux (RHEL) system, you can use the yum-plugin-protectbase
plugin. This plugin allows you to define "protected" Yum repositories, which will prevent packages from those repositories from being updated or removed.
To install and enable the yum-plugin-protectbase
plugin, follow these steps:
yum-plugin-protectbase
plugin:yum install yum-plugin-protectbase
Edit the /etc/yum/pluginconf.d/protectbase.conf
file: Open the /etc/yum/pluginconf.d/protectbase.conf
file in a text editor.
Add the repository to the protect
list: In the protect
list, add the name of the repository you want to protect. For example, to protect the base
repository, you would add the following line:
protect=base
/etc/yum/pluginconf.d/protectbase.conf
file and exit the text editor.This will protect the packages in the specified repository, preventing them from being updated or removed.
Keep in mind that you will need to have root privileges (or be a member of the sudo
group) in order to edit the /etc/yum/pluginconf.d/protectbase.conf
file.
You can also use the yum-plugin-versionlock
plugin to protect specific packages rather than entire repositories. This plugin allows you to specify the names of packages that should be locked, preventing them from being updated or removed.
To install and enable the yum-plugin-versionlock
plugin, follow these steps:
yum-plugin-versionlock
plugin:yum install yum-plugin-versionlock
yum versionlock
command and specify the name of the package. For example, to lock the nano
package, you can use the following command:yum versionlock nano
This will lock the nano
package, preventing it from being updated or removed.
You can repeat this step for any additional packages you want to lock.
yum versionlock list
command. This will display the names of all locked packages.