Web Development

Get a stable and secure server setup with CentOS, RPMForge, and Utter Ramblings

CentOS is a great server operating system that is completely compatible with Red Hat Enterprise Linux. Vincent Danen tells you how to optimize CentOS setup with RPMForge and Utter Ramblings repositories.

CentOS is a great server operating system that is completely compatible with Red Hat Enterprise Linux. As a result, nearly all of the packages available for Red Hat Enterprise Linux will work with CentOS.

The current release of CentOS is 5.2, with 5.3 expected shortly (perhaps even by the time you read this). One of the nice things about CentOS is that it has a focus on security and stability. The downfall, of course, is that it comes at the expense of newer versions of software. One example is PHP, which in CentOS is a security-patched copy of 5.1.6, whereas the current upstream version of PHP is 5.2.8. Using third-party repositories, you can have the stable base of CentOS with more up-to-date packages (of course, it goes without saying that you sacrifice some of the stability that makes CentOS so good by doing so!).

There are two third-party repositories that come into play here. The first is the RPMForge repository which will provide a number of useful updates, and the second is the Utter Ramblings repository which will provide new versions of PHP, Apache, and MySQL.

To set up RPMForge, you need to download the rpmforge-release file. This can be done by executing:

# rpm -ivh http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Make note of the architecture in both the URL and the filename itself; if you are running on x86_64, change the "i386" as appropriate. Once this is downloaded and installed, RPMForge is set up. Setting up the Utter Ramblings repository is slightly different. On the CentOS server, execute the following to install the signing key for the repository:

# rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

Next, create the file /etc/yum.repos.d/utterramblings.repo with the following contents:

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

This will set up the Utter Ramblings repository.

At this point, both repositories are set up. Execute yum update to update the metadata for the repositories; it will also install any new packages it finds (from RPMForge there are quite a few).

If you do opt to allow yum to update packages, note that the xdelta package will conflict on an x86_64 system. To remove this blocking package, execute:

# rpm -e xdelta-1.1.3-20.i386

This is only a problem on x86_64, however, as both the 32-bit and 64-bit xdelta packages are installed by default.

You may also wish to disable the repositories and call them only when you need to install certain packages, or add the yum priorities plugin to prevent third-party repositories from overriding the main repositories. This is really useful if you want to keep as close to the CentOS release as possible, but still want to use certain other packages from the third-party repositories.

To use priorities, install the yum plugin:

# yum install yum-priorities

Then, navigate to /etc/yum.repos.d/ and edit the various .repo files contained in the directory. In each section you can add a priority=X line that defines the priority for the repository. For the main repositories, the priority should be 1, and for third-party repositories this number should be higher (1 is the highest priority, 99 is the lowest).

To find the packages provided by a given repository, use yum list and grep the output for the repository name:

# yum list | grep utter

This will show all of the packages available in the utterramblings repository. This repository essentially only provides the latest Apache, PHP, and MySQL.

Third-party repositories are great ways of getting extra functionality out of your CentOS system that is not provided by the rather conservative base package list. With it, on my own CentOS server, I managed to easily upgrade my AMP stack to the latest versions, get the latest Subversion, and the latest Nagios, without compiling a thing.

Get a PDF version of this tip here.

Delivered each Tuesday, TechRepublic's free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

About

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

6 comments
fractal
fractal

The Utter Ramblings repository has not been updated for the past 2 years !!!

cmatthews
cmatthews

I take care of some auto dealerships and many are based on Reynolds-and-Reynolds systems running CentOS. Rock solid! It's worth noting that release 5.3 just hit P2P (I'm connected to 57 peers at >300kB/sec! - It's nice to see those with 100% stick around to help out distribution..)

Photogenic Memory
Photogenic Memory

I wanted to try something different than Fedora. So many people at the time were complaining about it. I remember when CentOS was supposed to be the workstation OS that compliments Fedora's server side. Wow! Seems like yesterday. Anyways, I've been minimally dispappointed by this OS. I don't think I give it up either. Long live CentOS!

lefty.crupps
lefty.crupps

RedHat can be such a headache in this regard, getting the LAMP stack working 'properly' with the much-needed options compiled into the various components here. Thank you for the information on getting this working. It would be nice if RHEL did this out of the box, however.

Bee Jay
Bee Jay

Been using CentOS for a couple of years now. It's a great OS, easy to setup and very easy to patch.

Editor's Picks