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 [local-rpms] name=Local Yum Repository baseurl=ftp://192.168.0.70/pub/linux/centos/$releasever/$basearch/ enabled=1 gpgcheck=0 #gpgkey= priority=1 # core packages [base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 priority=10 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 priority=10 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons #baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 priority=10 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 priority=10 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 priority=20 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 priority=20 [adobe-linux-i386] name=Adobe Systems Incorporated baseurl=http://linuxdownload.adobe.com/linux/i386/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux priority=30 # Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag # URL: http://rpmforge.net/ [rpmforge] 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 priority=40
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