No Gravatar

I am just putting a new development server together, using CentOS 5, and have come across the same headache as usual – managing standard and 3rd party rpm repositories and avoiding conflicts. I had forgotten about the excellent package yum-plugin-priorities, so here are some brief details on how to get started.

Package Prioritisation

The priorities plug-in for yum sorts out which of two or more packages from different repos takes priority thus avoiding system breakages. A really common package that I have found to cause problems is Subversion from Dag Wieer’s excellent RPMForge repo.

Let’s take an example of where I would like to use the regular CentOS repos alongside RPMForge repo and see how yum-plugin-priorities does it’s stuff.

Installation

So, installation of the plugin is easy:

[root@junkie /]# yum install yum-priorities

Once installed, check that the conf file (/etc/yum/pluginconf.d/priorities.conf) enables the plug-in with the following lines:

[main]
enabled=1

Once the plug-in is enabled you can use the following in your repo conf files to enable prioritisation:

priority=N

Where N is a number between 1 and 99, 1 being the highest.

CentOS Repo Priority Recommendations

Below I have reproduced repo priority recommendations from the CentOS wiki:

[base], [addons], [updates], [extras] ... priority=1 

[centosplus],[contrib] ... priority=2

Third Party Repos ... priority=N
(where N is > 10 and based on your preference)

What my Repo Files Look Like
For reference I have reporoduced 2 of my repo conf files so that you get an idea of how the prioritisation looks – firstly the CentOS-Base.repo file

[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
priority=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#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
priority=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#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
priority=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#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
priority=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#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
priority=2
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#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
priority=2
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

Secondly, the repo file for Dag’s repo, rpmforge.repo

[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 = 50

As you can see, updates from Dag’s repo has a much lower priority. When I run yum update I now see what has been excluded due to prioritisation.

[root@junkie /]# yum update
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * rpmforge: apt.sw.be
 * base: mirror.ukhost4u.com
 * updates: mirror.ukhost4u.com
 * centosplus: mirror.ukhost4u.com
 * addons: mirror.ukhost4u.com
 * extras: mirror.ukhost4u.com
474 packages excluded due to repository priority protections
Setting up Update Process
No Packages marked for Update

References
http://wiki.centos.org/PackageManagement/Yum/Priorities
http://wiki.centos.org/AdditionalResources/Repositories
http://dag.wieers.com/rpm/

  • Share/Bookmark

No Comments on “Yum with Multiple Repos: yum-plugin-priorities on CentOS”

You can track this conversation through its atom feed.

No one has commented on this entry yet.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>