How to install EPEL and apachetop on Centos 5 and Centos 6

I wanted to use apachetop to monitor one of my servers in real time. Much like top, apachetop reads the acces_log file in /var/logs/httpd/ and displays the results as apache processes happen.

Rather than installing apachetop from source, I thought a simple command like

yum install apachetop

should to the trick… but it doesn’t work by default. Now what?

Well an install via yum will only work if it is configured to look in the right repositories. Apachetop however is not part of the standard repos, hence we need to add what’s known as the EPEL package to yum (it stands for Extra Packages for Enterprise Linux).

In this article I’ll show you how to do it and how to run apachetop.

Prerequisites

First you need to know which version of Centos you’re running (currently CentOS 5.x or 6.x). You can find out using this command:

cat /etc/*release

You’ll also need to know if you’re running the 32-bit or 64-bit version of the OS. Find out by checking your kernel version via

uname -mrs

Check the last two digits of the output: i386 would mean 32-bit, x86_64 would mean 64-bit.

With all that info at hand, let’s install EPEL. There are several mirrors out there, some of them are working and some of them are not.

The official ones maintained by The Fedora Project are not working anymore, you can find them in the link below. But thanks to Blueapple’s Livejournal the following ones should do the trick!

Issue the following command while being logged on as root:

CentOS 5 / 32-bit

rpm -Uvh http://mirror.chpc.utah.edu/pub/epe<wbr>l/5/i386/epel-release-5-4.noarch.rpm</wbr>

CentOS 5 / 64-bit

rpm -Uvh http://mirror.chpc.utah.edu/pub/epe<wbr>l/5/x86_64/epel-release-5-4.noarch.rpm</wbr>

CentOS 6 / 32-bit

rpm -Uvh http://mirror.chpc.utah.edu/pub/epel/6/i386/epel-release-6-7.noarch.rpm

CentOS 6 / 64-bit

rpm -Uvh http://mirror.chpc.utah.edu/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm

Once installed, yum will be able to look in EPEL and find other packages, such as the one we’re after. Let’s go and install apachetop now:

yum install apachetop

Sorted!

How to use apachetop

You invoke it by just typing

apachetop

or if you’d like to specify a file other than /var/log/httpd/access_log (which is the default) with

apachetop -f /path/to/file

You can quit back to the command prompt as usual with CTRL-C.

Have fun and enjoy 😉

Further Reading





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.