Install Cacti on a Centos 6.x Virtual Host

posted in: Technical | 0

Installation process starts by installing the following packages:

yum install httpd php php-mysql php-snmp mysql mysql-server net-snmp rrdtool net-snmp-utils
yum install php-xml php-session php-sockets php-ldap php-gd

Next make sure that all of the installed package are up and running by issuing the following commands:

chkconfig httpd on
chkconfig mysqld on
chkconfig snmpd on

service httpd start
service snmpd start
service mysqld start

Create a database for Cacti:

mysql -u root -p
create database cacti;
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuserpassword';
flush privileges;

Virtual host setting:

mkdir -p /var/www/
cd /var/www/


mv cacti-0.8.8c public_html/
chown -R cactiuser:apache public_html/

Import cacti default database:

cd /var/www/cactifolder/public_html
mysql -u root -p cacti < cacti.sql

Adding user for cacti:

useradd -d /var/www/cactifolder/public_html -s /sbin/nologin cactiuser

Edit include/config.php to suit the needs:

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "yourcactipassword";
$database_port = "3306";
$database_ssl = false;
$url_path = "/";

Edit the httpd.conf to acomodate new virtual host for cacti web access:

nano /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
DocumentRoot /var/www/
ErrorLog /var/www/
CustomLog /var/www/ combined
#ErrorDocument 403 /error403.php
#ErrorDocument 404 /error404.php
#ErrorDocument 500 /error500.php

Adding cacti poller schedule to /etc/crontab:

*/5 * * * * cactiuser php /var/www/ > /dev/null 2>&1

Go to cacti web access via and login with the following information:
username: admin
password: admin (default password)

Change cacti default password:
Go to “Console -> System Utilities” and click on “Rebuild Poller Cache” after the first login!

Adding Mikrotik template for a new installed cacti:

Download Mikrotik Cacti template (update 02/10/2009)


Copy each file to appropriate location as follows:

zipdir/scripts/mikrotik_wireless_interfaces.php -> cacti-web-dir/scripts/mikrotik_wireless_interfaces.php
zipdir/scripts/mikrotik_ppp_connections.php -> cacti-web-dir/scripts/mikrotik_ppp_connections.php
zipdir/resources/script_server/mikrotik_wireless_interfaces.xml -> cacti-web-dir/resource/script_server/mikrotik_wireless_interfaces.xml
zipdir/resources/snmp_queries/mikrotik_queue_simple.xml -> cacti-web-dir/resource/snmp_queries/mikrotik_queue_simple.xml
zipdir/resources/snmp_queries/mikrotik_queue_tree.xml -> cacti-web-dir/resource/snmp_queries/mikrotik_queue_tree.xml
zipdir/resources/snmp_queries/mikrotik_wireless_client.xml -> cacti-web-dir/resource/snmp_queries/mikrotik_wireless_client.xml