YUM-Priorities Configuration for a CentOS Desktop

When it comes to software for your CentOS installation, there is no such thing as a good yum configuration, but a configuration that can bring you the software you need, while, at the same time, causing the least possible trouble regarding core package upgrades. This small article goes into the details of configuring YUM using the yum-priorities plugin. I use the following yum configuration on my desktop running CentOS 5.3 (at the moment of writing), but i do not mean to advertise specific 3rd party repositories and undervalue the rest. I mainly focus on setting priorities for them, so to avoid the trouble later.

First of all, some notes about the yum-priorities plugin and why it is important. By default, YUM installs or upgrades the latest version of an RPM package, regardless of the repository it (the package) exists in. This is normal and complies with yum’s role, which is to update your system with newer versions of software. But, this behavior could easily result in many core packages being overridden by 3rd party RPMs. This may not seem like trouble at first, but there is high probability that, when you upgrade your system at a later time, the upgrade procedure might get stuck because of dependency issues. These issues might even happen to the packages of the same repository. So, imagine how easy it is to happen to packages created by two or more different vendors and how difficult the resolution might be in the latter case. Mixing different yum repositories avoiding as much dependency-related trouble as possible is what yum-priorities does. Here is the official description of the plugin:

This plugin allows repositories to have different priorities. Packages in a repository with a lower priority can’t be overridden by packages from a repository with a higher priority even if repo has a later version.

Here follows my yum repositories configuration:

# Custom builds
name=Local Yum Repository

# core packages
name=CentOS-$releasever - Base

#released updates
name=CentOS-$releasever - Updates

#packages used/produced in the build but not released
name=CentOS-$releasever - Addons

#additional packages that may be useful
name=CentOS-$releasever - Extras

#additional packages that extend functionality of existing packages
name=CentOS-$releasever - Plus

#contrib - packages by Centos Users
name=CentOS-$releasever - Contrib

name=Adobe Systems Incorporated

# Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
# URL: http://rpmforge.net/
name = Red Hat Enterprise $releasever - RPMforge.net - dag
#baseurl = http://apt.sw.be/redhat/el5/en/$basearch/dag
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

Here are some notes:

  • A repository’s priority is rated like this: the smaller the priority number, the higher the priority of the repository. Packages from a specific repository cannot override (upgrade) packages of a repository with higher priority (smaller priority number).
  • In the above setup, the repository with the highest priority is my Local RPM repository. This repo contains custom builds of packages. Custom builds means that I have enabled or disabled specific compilation-time switches or that I have used a patch that is not yet used in the mainstream package. Usually, when I create custom builds of RPMs, I know what I am doing and, of course, I do not want my custom RPMs to be overridden by packages from other repositories, even official ones. So, this repository has the highest priority (priority=1).
  • base, updates, addons, extras are the official CentOS repositories and they all have priority 10.
  • As you can see in the above setup, centosplus and contrib repositories are not enabled. However, I have set a priority number that is between (priority=20) the priority number of the official repositories and the priority number of the 3rd party repositories.
  • Next comes Adobe‘s yum repository (priority=30) and finally RPMforge (priority=40). These are both 3rd party repositories. I highly recommend that you choose your 3rd party repositories carefully and set their priorities wisely. I would also advise against setting the same priority on two or more 3rd party repositories, unless you are 100% certain that they complement each other. If I ever use any other 3rd party repository, it will get a priority higher than 40 and so on.

So, this is how I have configured priorities on yum repositories at the moment. Note that this configuration is used on my desktop. On my Xen Dom0 and the four DomUs, which by the way all run CentOS, I use EPEL instead of RPMforge. Remember, it’s your own software needs that govern the use of 3rd party repositories.

Your feedback is welcome.

YUM-Priorities Configuration for a CentOS Desktop by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2009 - Some Rights Reserved

George Notaras avatar

About George Notaras

George Notaras is the editor of the G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is an enthusiast self-taught GNU/Linux system administrator. He has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora. He has also developed some open-source software projects in his spare time.

2 responses on “YUM-Priorities Configuration for a CentOS Desktop

  1. dan Permalink →

    Hey there –

    As you appear to be quite a yum wizard, hopefully you can point me in the right direction here. For my CentOS system I have been updating things via yum through Webmin for quite a while – and never had an issue till today. After realizing that the system was still sitting on the same “updating” page for two hours I restarted it — and then found all sorts of problems. I can login via an SSH terminal from another system on the network or get there via webmin, but the monitor on the server itself never gets to a login – just a spinning cursor. What I see from webmin or a terminal window when I run yum is an error – found a few posts on it too, but nothing as a clear fix.

    [root@trailrunner yum]# yum clean all
    Traceback (most recent call last):
    File “/usr/bin/yum”, line 28, in ?
    import yummain
    File “/usr/share/yum-cli/yummain.py”, line 29, in ?
    import cli
    File “/usr/share/yum-cli/cli.py”, line 30, in ?
    import output
    File “/usr/share/yum-cli/output.py”, line 26, in ?
    from i18n import _
    ImportError: No module named i18n
    [root@trailrunner yum]#

    Though I use to work at the Command line regularly, those skills are rusty these days. I suspect that I should try reinstalling Yum directly – but not entirely sure how to do that, and what I should blow out prior to doing that which might also get the server unstuck.

    Truly hoping you have a suggestion.

    1. George Notaras Post authorPermalink →


      Re-installing yum is definitely the first thing you should try, but, afterwards, make sure you investigate what might have caused the whole issue. Why is the i18n yum module missing?

      In order to re-install yum use the following rpm command directly as root:

      rpm --force --replacepkgs <url_to_yum.rpm>

      Hope this helps