Installing Cacti

Server monitoring is one of the most important aspects of managing a network. Cacti is a free PHP/MySQL script which can monitor everything from process counts to bandwidth, and is fairly easy to setup and use. If you have multiple clients you can even delegate specific access levels so that they can only view the graphs relevant to them.

This tutorial will guide you through setting up and configuring Cacti on a Linux server. 

This tutorial assumes that you are running a vanilla installation of CentOS 5.1 with a typical LAMP setup. The main requirements for a Cacti installation are Apache, MySQL, PHP (with php-snmp and php-mysql), and net-snmp. 

First of all, login to your server via SSH. One of the core requirements of Cacti is RRDTool, which unfortunately isn’t in the CentOS repositories. However, there are a number of RPMs maintained for RHEL, which you can find here: 

I used the i386 packages for RHEL5, which at the time of writing were as follows:


wget these to your server, and then run the following rpm command to install them:

rpm -ivh  rrdtool-1.2.23-1.el5.rf.i386.rpm rrdtool-devel-1.2.23-1.el5.rf.i386.rpm perl-rrdtool-1.2.23-1.el5.rf.i386.rpm

If you haven’t done so already, install net-snmp:

yum install net-snmp

At this point we will add a simple snmp configuration file for Cacti. Navigate to /etc/snmp and edit snmpd.conf. Delete everything in there and insert the following:

rocommunity public
syslocation locatationofserver
dontPrintUnits true

This simple configuration is enough to get Cacti up and running. Save and exit the file, then restart snmpd:

service snmpd restart 

Now setup a user account for cacti. Depending on your system setup you will have to do this through SSH, or you can set up an account through cPanel/Plesk/Webmin. Once this is done, create a new MySQL database and assign a user to it. 

Now go to the cacti website and download the latest release from here: 

Extract it, and upload it via FTP. Alternatively, wget the archive using SSH, like so:


Now edit the file config.php in the include directory. Change the database connections settings to match the database you created, and save it. Now just browse to the cacti directory in your web browser and follow the installer.

The final step to take is to setup the cronjob to run the poller (which processes all the Cacti stats). You can do this through your control panel or through SSH by editing the /etc/crontab file. Here is what mine looks like:

*/5 * * * * cacti php /var/www/html/poller.php > /dev/null 2>&1

This runs the poller as the user cacti every 5 minutes, which is the standard setting.

Now login to Cacti. You will be prompted to change your administrator password when you first login. Once this is done, you will be presented with the Cacti console.

Congratulations, you have succesfully installed Cacti! You can now add devices and configure graphs using the control panel.