How to configure repos to not overwrite base packages?

The greatest fear with adding additional and especially third party repos such as EPEL (we did a blog post on how to install EPEL earlier) is that it MAY overwrite base packages and bring the system to an unstable state.

We can fix this issue by installing Yum Priorities plugin

on CentOS 5:

yum install yum-priorities

on CentOS 4 or CentOS 6:

yum install yum-plugin-priorities

Then make sure that the plugin is enabled

nano /etc/yum/pluginconf.d/priorities.conf

Now there are two ways to do it, either set HIGHEST priority to CentOS repos OR set lowest priority to other repos. This is done by adding the line

# N=1 highest priority
# N=99 lowest priority
priority=N

In this blog post, I will set 1 as the priority (highest) for my CentOS Base repo

nano /etc/yum.repos.d/CentOS-Base.repo

So that it becomes

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[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-6
priority=1

#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-6
priority=1
...
...
...

Other repos do not need updating since I have assigned CentOS repos with the highest priority. The default priority for repositories is 99.

Installing EPEL repo

Installing EPEL repo in CentOS is simple, if you do not know what EPEL is, read more about it here.

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

To configure epel or disable it use

nano /etc/yum.repos.d/epel.repo

and then switch the config enabled to 0 (or vice versa)

Don’t forget to do the following

yum clean all

Good bye CentOS! Hello Ubuntu

Its been about almost more then two years since I have been playing with CentOS on many different platforms etc. Its very stable but on the other hand, PHP/MySQL updates are very hard to get and still PHP is 5.1.6. I tried EPEL repo and it updated PHP to 5.3.1 but still there were conflicts with stuff and many core packages.

So, I thought why not move to Ubuntu since it has just announced 10.04LTS (Long Term Support) in April 2010. Folks at iWeb were really nice to do a reinstall without any charges and also process a memory upgrade request at an amazing 50% discount.

Ubuntu 10.04 LTS

  • Apache 2 version is 2.2.14
  • PHP version is 5.3.2
  • MySQL version is 5.1.41-3ubuntu12
  • SVN (Subversion) version is 1.6.6

As a comparison CentOS 5.4 has the following versions

  • Apache 2 version is 2.2.3
  • PHP version is 5.1.6
  • MySQL version is 5.0.77
  • SVN (Subversion) version is 1.4.2

So if you are a PHP developer looking to deploy a Linux flavour on your new box, choose Ubuntu 🙂