Add rpmforge to yum under CentOS 6

See also: http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

Installing for CentOS 5 is slightly different, see the link above for more info.

Assuming you have root permissions...

Install yum priorities...

yum install yum-priorities -y

Edit the /etc/yum/pluginconf.d/priorities.conf and ensure the following is present:

[main]
enabled=1

Normally, the installer sets the plugin enabled, but it doesn't hurt to check (or know where to turn off the plugin if you don't want it).
You should see priorities plugin in the Enabled plugins list that yum prints when you run it normally.

Some guides don't mention this but do talk about adding the priorities, however, it seems that priorities are not installed by default even under CentOS 6, so you need to install them first.
If they are already installed the install command will do nothing, but they may be disabled in the config file, so make sure you check it.

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-1.el6.rf.x86_64.rpm

Or use i386 instead of x86_64 if you are on 32-bit, which obviously you aren't...

If you want to check the downloads and maybe avoid some warnings, install DAG’s GPG Key:

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -ivh rpmforge-release-0.5.2-1.el6.rf.x86_64.rpm

May get a warning, but it should proceed anyway.

Edit the file /etc/yum.repos.d/CentOS-Base.repo and add priorities to the bottoms of all the repo sections:

[base]
priority=1

[updates]
priority=1

[extras]
priority=1

[centosplus]
priority=4

[contrib]
priority=4

The latter two sections are probably disabled anyway, but set them anyway.

Edit the file /etc/yum.repos.d/rpmforge.repo and set the priority for the rpmforge section...

[rpmforge]
priority=6

Then do a yum update -y to cache the rpmforge repo.

Setting the rpmforge repo to a higher priority ensures that it is only used if the other (standard) repos don’t have the package and also ensures that lower priority repos will not be used to update something installed from a higher priority one.