Tuesday, September 28, 2010

The EPEL repository for CentOS Linux and 404 Errors

I want to blog consistently this coming month. Write something everyday in the evenings or very early mornings without waiting for the weekend. Let's see if I can keep that promise..

First post of the month will not be about CSS but don't worry, I'll be back to CSS topics soon, just want to post a solution to a problem I had today in case it might help someone else.

I needed to install some software on a CentOS Linux machine. CentOS is known for it's reliability, but the downside of that is you don't automatically get access to all the software packages that you get with something like Ubuntu. The theory is that CentOS is slow to change and will only incorporate packages into the supported software repositories that are proven to be rock solid reliable. If you want to be on the bleeding edge, look elsewhere. If you need Enterprise class reliability, CentOS might be for you.

Anyway, I needed to install a some software that is not in the official CentOS repositories, but which is available in the EPEL repository (Extra Packages for Enterprise Linux) does. The first thing you need to do is add EPEL to the set of repositories that your CentOS installation knows about:

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

Note that if you are on a 32 bit version of CentOS the "x86_64" part of that command should be "i386" instead.

Now in theory you should be able to just type: yum install packagename but when I did that today I got many HTTP 404 errors, one for each repository mirror. I spent a couple of hours trying to figure out what was wrong, then I found a solution:

Edit the repository file at /etc/yum.repos.d/epel.repo, which should look like this:

[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
# baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

( other entries omitted )

Now uncomment the line that starts with baseurl, and comment out the line that starts with mirrorlist, like so:

[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
# mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

Now you can install software packages from EPEL, using yum.

This isn't the best long term solution since the repository mirrors should really work, but for now with the mirrors apparently broken, this solution works.

4 comments:

Anonymous said...

Many thanks!!! Your post help's me...

Anonymous said...

Quite fantastic. Cheers!

Anonymous said...

Thank you for solving the yum update annoyance... that saved me lots of frustration :)

Anonymous said...

thanks a lot!!

Post a Comment

Note: Only a member of this blog may post a comment.