Skip to content

Installing Cacti on CentOS 5.5

In this tutorial we will be installing Cacti on CentOS 5.5 using the LCMP stack (Linux, Cherokee, MySQL and PHP).

What is Cacti? Cacti is a complete network, server and application graphing solution harnessing the power of RRDtool OpenSource industry standard, high performance data logging and graphing.

So before we start just some general house keeping. The base CentOS 5.5 server hostname and IP address that we’ll be using in this tutorial:

  • centos01.how2centos.com (IP 10.0.0.3)

The Cacti server will eventually be available on http://cacti.how2centos.com

The assumption, for this Cacti and CentOS 5.5 tutorial, is that you are running as root and have a medium understanding of the software required or you’re Awesome.

# yum install yum-priorities 

Install the RPMForge i386 YUM Repository

# rpm -Uvh http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

Install the EPEL i386 YUM Repository

# rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Install the IUS i386 YUM Repository

# rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm

Install Cherokee web server

# yum install cherokee rrdtool

Install PHP 5.3

# yum install php53u-pear php53u php53u-cli php53u-common php53u-devel php53u-gd php53u-mbstring php53u-mcrypt php53u-mysql php53u-pdo php53u-soap php53u-xml php53u-xmlrpc php53u-bcmath php53u-pecl-apc php53u-pecl-memcache php53u-snmp 

Install MySQL and MySQL Server

# yum install mysql mysql-server

Install SNMP

# yum install net-snmp net-snmp-utils

Install Cacti

# yum install cacti

Configure snmpd, move snmpd.conf and create a new one. The ‘snmpuser’ is what you’ll use later in the Cacti interface.

# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old
# echo "rocommunity        snmpuser" > /etc/snmp/snmpd.conf

Let make sure that everything is added to runlevels 2, 3, 4 and start them up.

# chkconfig mysqld on
# chkconfig snmpd on
# chkconfig cherokee on
# service mysqld start
# service snmpd start
# service cherokee start

Create ‘cacti’ MySQL database and grant privileges to ‘cactiuser’ with password ‘cactipassword’

# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14323
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>create database cacti;
mysql>GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipassword';
mysql>quit

Import the Cacti database schema

# mysql -ucactiuser -pcactipassword cacti < /var/www/cacti/cacti.sql

Configure Cacti with the details above.

# vi /var/www/cacti/include/config.php 
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipassword";
$database_port = "3306";

Once all that has been done time to get PHP 5.3 working with Cherokee and then adding the Cacti virtual server.

Firstly lets get PHP 5.3 working with Cherokee

# cherokee-admin -b


Finally add the Cacti virtual server and browser to the URL and follow the onscreen instuctions.