CentOS / Redhat: Protect Yum Repo's Packages

CentOS / Redhat: Protect Yum Repo's Packages

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:

  1. Install the plugin: Run the following command to install the yum-plugin-protectbase plugin:
refer to:‮l‬autturi.com
yum install yum-plugin-protectbase
  1. Edit the /etc/yum/pluginconf.d/protectbase.conf file: Open the /etc/yum/pluginconf.d/protectbase.conf file in a text editor.

  2. 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
  1. Save the file and apply the changes: Save the changes to the /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:

  1. Install the plugin: Run the following command to install the yum-plugin-versionlock plugin:
yum install yum-plugin-versionlock
  1. Lock a package: To lock a package, use the 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.

  1. List locked packages: To view a list of locked packages, use the yum versionlock list command. This will display the names of all locked packages.
Created Time:2017-10-27 14:56:37  Author:lautturi