Sorting out YUM repositories on CentOS 5.4

… or any other CentOS 5.X flavour for that matter.

By default, freshly installed CentOS 5.X has the following Yum repositories enabled:

addons                                             CentOS-5 - Addons
base                                               CentOS-5 - Base
extras                                             CentOS-5 - Extras
updates                                            CentOS-5 - Updates

These are all defined in /etc/yum.repos.d/CentOS-Base.repo configuration file. Repositories enabled by default provide you with the core CentOS packages and updates for them. So you must have them enabled if you want your updates to work correctly. It is also important that these repositories take precedence over other repositories that you are going to use.

I will show later how to use Yum priorities package, just note that these are going to be priority one repositories

Enable standard CentOS repositories

There are two useful repositories defined in the configuration, but not enabled:

  • CentOS Plus. Packages in this repository contains upgraded versions of the software. If you enable this repository, after applying updates/upgrades your system will no longer be of the original version you have installed. Fear not though, all packages are tested by CentOS team and will no cause any issues. So unless you have really good reason to keep you installation at the same version level I’d recommend enabling this repository.
  • Contrib. Packages supplied and maintained by CentOS users. These packages are not inspected by CentOS team, but they are not attempt to replace/modify core CentOS package set, so normally this repository should not cause any issues. Beware that some packages are not following mainstream CentOS very closely. I normally don’t have this enabled.

These two repositories are going to get priority two setting. If you wish to enable them, edit default /etc/yum.repos.d/CentOS-Base.repo Yum repository configuration file and remove (or rather comment out) “enabled=0” line.

Install and enable EPEL repository

I must mention, that in this article I’m mostly talking about CentOS installation that is used for server environment. Therefore I’m not really interested in repositories that provide packages such as DVD or other multimedia decoders and players.

One of the most useful repositories for your server environment is EPEL repository – Extra Packages for Enterprise Linux. This repository is maintained by Fedora project, and every effort is made to keep this repository as least  intrusive as possible, so in theory enabling and using this repository should not break or otherwise cause issues to your CentOS installation.

First of all, you need to install EPEL repository configuration files:

[root@centos54 ~]# rpm -ihv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
Retrieving http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
warning: /var/tmp/rpm-xfer.RT5AzP: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
[root@centos54 ~]#

This provides you with two configuration files: base and testing. Don’t worry about testing one and leave it disabled.

Main configuration comes with three sections:

  • Base packages. This is enabled by default.
  • Debug packages. Disabled, and no need to enable unless you want to use debug packages.
  • Source packages. Disabled. Enable only if you want to be able to install source RPMs from EPEL. Useful if you want to rebuild them to your specific needs. I’d recommend to leave it disabled and enable on yum command line only when you really need to install source RPMs.

These should be getting priority 3 setting.

Set priorities for Yum repositories

So if you enabled repositories from the previous section and installed EPEL repository configuration, here’s what you should see in you repositories list:

addons                             CentOS-5 - Addons
base                               CentOS-5 - Base
centosplus                         CentOS-5 - Plus
epel                               Extra Packages for Enterprise Linux 5 - i386
extras                             CentOS-5 - Extras
updates                            CentOS-5 - Updates

Now I need to set priorities for each repository. Install Yum priorities package:

# yum install yum-priorities

Make sure new plugin is enabled:

[root@centos54 ~]# cat /etc/yum/pluginconf.d/priorities.conf
[main]
enabled = 1
[root@centos54 ~]#

Now you can set priorities for each repository. It’s done by adding “priority=X” for each repository section in repository configuration files. Here’s what I ended up with:

[base]
...
priority=1
 
[updates]
...
priority=1
 
[addons]
...
priority=1
 
[extras]
...
priority=1
 
[centosplus]
...
priority=2
 
[contrib]
...
priority=2
 
[epel]
...
priority=3

Now you should be good to do upgrades and install packages as you see fit for your system.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Live
  • Netvibes
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks

Related posts:

  1. Building python 2.6.4 RPM for CentOS 5.4
  2. Building and running Google Chrome OS on VirtualBox
  3. Use SSH to upgrade WordPress plugins automatically
  4. Basic Apache security
  5. Securing WordPress