Pages

Thursday, May 31, 2012

Install Cacti on Centos 5.7


yum install priorities

For x86 version

For x64 version

Install Apache
yum install httpd

Configure Apache to start on boot
/sbin/chkconfig  httpd on

Configure iptables to allow Apache traffic
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart

Install Cacti & Required Dependencies
yum install cacti mysql-server mysql php5 php-mysql net-snmp net-snmp-utils php-snmp liberation-fonts

Configure mysqld to start on boot
/sbin/chkconfig mysqld on

Start mysqld
/etc/init.d/mysqld start

Set the password for the MySQL root user
/usr/bin/mysqladmin -u root password <PASSWORD-GOES-HERE>

Create the MySQL cacti database (Note: The password you will be prompted for is the one you just set.)
/usr/bin/mysqladmin -u root -p create cacti

Log into the MySQL database and grant the cactiuser access to the cacti database
/usr/bin/mysql -u root -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 46
Server version: 5.0.77 Source distribution

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

mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY '<CACTIUSER-PASSWORD-GOES-HERE>';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye


Populate the cacti database (Note: You will use the password you created for cactiuser here)
/usr/bin/mysql cacti -u cactiuser -p < /var/www/cacti/cacti.sql

Modify /var/www/cacti/include/config.php to have the correct password for the cacti database

$database_password = "<CACTIUSER-PASSWORD-GOES-HERE>";

Modified /etc/httpd/conf.d/cacti.conf to fix url and allow access from anywhere


Alias /cacti /var/www/cacti/
<Directory /var/www/cacti/>
    DirectoryIndex index.php
    Options -Indexes 
    AllowOverride all 
    order deny,allow
    deny from all
    allow from 127.0.0.1
    allow from 192.168.0.0/24 #Network Address Range 
    AddType application/x-httpd-php .php
    php_flag magic_quotes_gpc on
    php_flag track_vars on
</Directory>

Start Apache
/etc/init.d/httpd start

Go to http://servername/cacti/ & go through the following screens