一、安装配置依赖包。

[root@cacti ~]# yum -y install httpd php php-mysql mysql-server perl-DBD-MySQL php-pdo net-snmp* ruby ruby-devel
[root@cacti ~]# chkconfig httpd on
[root@cacti ~]# chkconfig mysqld on
[root@cacti ~]# vim /etc/snmp/snmpd.conf
access  notConfigGroup ""      any       noauth    exact  all   none none
view all    included  .1                               80
[root@cacti ~]# chkconfig snmpd on

二、安装RRDTool,Cacti

[root@cacti ~]# yum -y install rrdtool
[root@cacti tmp]# tar -zxvf cacti-0.8.8b.tar.gz -C /var/www/html/
[root@cacti tmp]# cd /var/www/html/
[root@cacti html]# mv cacti-0.8.8b cacti
[root@cacti html]# chown -R root:root cacti
[root@cacti html]# mysqladmin -u root password 123456
[root@cacti html]# mysql -u root -p
Enter password:
mysql> create database cacti;
mysql> grant all privileges on cacti.* to cacti@localhost identified by 'cacti';
mysql> grant all privileges on cacti.* to cacti@127.0.0.1 identified by 'cacti';
mysql> flush privileges;   #重载mysql授权表
mysql> quit
[root@cacti html]# crontab -e
*/1 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1
[root@cacti html]# useradd cacti
[root@cacti html]# echo "cacti" |passwd --stdin cacti
[root@cacti html]# mysql -u cacti -p cacti  < /var/www/html/cacti/cacti.sql
[root@cacti ~]# vim /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$database_ssl = false;

三、修改cacti管理密码,修改mysql账号密码。

[root@localhsot]# mysql -u root -p
mysql> show databases;
mysql> use cacti;
mysql> show tables;
mysql> select from user_auth;
mysql> update user_auth set password=md5("cactipasswd") where id='1';
################################
[root@localhsot]# service mysqld stop
[root@localhsot]# mysqld_safe --skip-grant-tables &
[root@localhsot]# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
[root@localhsot]# service mysqld restart