1.安装epel源;
[root@Cacti ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@Cacti ~]# rpm -ivh epel-release-6-8.noarch.rpm
2.安装apache,mysql,php,php-snmp,net-snmp,rrdtool;
[root@Cacti ~]# yum install -y httpd httpd-devel mysql mysql-server php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql php-snmp net-snmp-utils net-snmp-libs php-pear-Net-SMTP rrdtool
3.启动服务并设置开机启动;
[root@Cacti ~]# /etc/init.d/httpd start
[root@Cacti ~]# /etc/init.d/mysqld start
[root@Cacti ~]# /etc/init.d/snmpd start
[root@Cacti ~]# chkconfig httpd on
[root@Cacti ~]# chkconfig mysqld on
[root@Cacti ~]# chkconfig snmpd on
4.安装cacti;
[root@Cacti ~]# yum install -y cacti
5.配置mysql;
[root@Cacti ~]# mysqladmin -u root password "123456"
[root@Cacti ~]# mysql -u root -p123456
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit;
Bye
[root@Cacti ~]# rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-0.8.8b/cacti.sql
[root@Cacti ~]# mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
[root@Cacti ~]# vim /etc/cacti/db.php
26 $database_type = "mysql";
27 $database_default = "cacti";
28 $database_hostname = "localhost";
29 $database_username = "cacti";
30 $database_password = "centos";
31 $database_port = "3306";
32 $database_ssl = false;
6.配置apache服务;
[root@Cacti ~]# vim /etc/httpd/conf.d/cacti.conf
14 <Directory /usr/share/cacti/>
15 <IfModule mod_authz_core.c>
16 # httpd 2.4
17 Require host localhost
18 </IfModule>
19 <IfModule !mod_authz_core.c>
20 # httpd 2.2
21 Order deny,allow
22 Deny from all
23 Allow from 192.168.1.0/24
7.编辑cron cacti;
[root@Cacti ~]# vim /etc/cron.d/cacti
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1 #取消注释
8.开启cacti web页面安装;
访问地址:http://服务器ip/cacti
默认用户名密码都是admin。