24/7/365 Support

Priorities in CentOS

In this process, we will investigate the task of preparing YUM to manage additional repositories by installing a plugin known as YUM priorities. YUM has the ability to search, remove, install, retrieve, and update packages from various remote locations. Such features make YUM a powerful tool, but if you ever decide to add an additional third-party repository, there is a chance that conflicts will render the system unstable. Stability is one of the many advantages of using the CentOS operating system, and it is the purpose of this process to show you how this confidence can be maintained while simultaneously allowing for the addition of new repositories.

To Start With: What Do You Need?

To complete this process, you will require a working installation of the CentOS 7 operating system with root privileges, a console-based text editor of your choice, and a connection to the Internet in order to facilitate the download of additional packages.

The Process:

This process will show you how to prepare YUM in order to manage the process of using one or more third-party repositories by installing and configuring YUM priorities:

  1. To begin this process, log in as root and type the following:
    yum install yum-plugin-priorities
  2. Confirm the installation, and when complete type what is shown here:
    vi /etc/yum/pluginconf.d/priorities.conf
  3. You should ensure that this file indicates that the plugin is enabled. It should show the instruction enabled = 1. It is not expected that you will need to change anything in this file, but if you have made any changes, simply save and close the file before proceeding.
  4. We now need to establish a priority value for each repository. This is a numeric value in ascending order, where the highest priority is given the lowest number. To do this, open the following file as shown next:
    vi /etc/yum.repos.d/CentOS-Base.repo
  5. Add the following line at the end of the [base] section:
    priority=1
  6. Now, add the following line at the end of the [updates] section:
    priority=1
  7. And finally, add the following line at the end of the [extras] section:
    priority=1
  8. When complete, save and close the file before running a package update:
    yum update

How Does It Work?

YUM priorities is a simple plugin that enables YUM to decide what repositories will assume the highest priority when installing and updating new packages. Using this plugin will reduce the chance of package confusion by ensuring that any particular package will always be installed or updated from the same repository. In this way, you can add an unlimited number of repositories and enable YUM to stay in control of package management.

So, what did we learn from this experience?

Enhancing YUM with this plugin was simply a matter of installing the yum-pluginpriorities package and ensuring that it was enabled in its configuration file. We then discovered that the priority is set in ascending order, where the lowest values are given precedence over all others. This, of course, serves to simplify the overall process, and for this reason, we ensured that the default repositories were given a value of 1 (priority=1).

This will ensure that the default repositories maintain the highest priority, so when you do decide to add additional repositories you could assign them a priority value of 2, 3, 4… and 10, or more. On the other hand, it should be noted that we only set this value across three main sections: [base], [updates], and [extras]. In simple terms, this was only because the other sections are shown to be disabled. For example, you may have noticed that the [centosplus] section in /etc/yum.repos.d/CentOS-Base.repo include the following line: enabled=0, whereas the [updates] and [extras] sections show this value as enabled=1. Of course, if you intend to activate this repository, you will need to set a priority value for it, but for the purpose of this process, such an action was not required.
Finally, we ran a simple YUM package update in order to activate our revised settings.

So, as we can see, YUM priorities is an extremely flexible package that enables you to determine what repositories take priority when you want to expand your installation options. However, you should always be aware that YUM priorities may not be appropriate for your system, as you are giving it the power to decide what packages are to be ignored, what packages are installed, what packages are updated, and in what order and from which repository you will get them. For most users who tend not to stay away from the typical server functions, this may not be an immediate concern; you may even safely ignore this warning. But if stability and security are an overriding concern, and you do intend to use additional packages from external repositories, then you should give careful consideration to the use of this plugin or at least consider and research the integrity of the third-party repositories used.

 

Help Category:

What Our Clients Say