一.安装nginx,php,mysql
详见张宴的 Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的Web服务器(第6版)http://blog.s135.com/nginx_php_v6/
二.安装 RRDtool和net-snmp
yum install rrdtool
yum install net-snmp
yum install net-snmp-utils
修改snmp配置
shell>vi /etc/snmp/snmpd.conf
把第89行前面的注释符号#去掉,变成
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
在62行进行修改:将
access notConfigGroup "" any noauth exact systemview 改为
access notConfigGroup "" any noauth exact mib2 none none
三.安装cacti
1. 解压
shell>cp cacti-version.tar.gz /usr/local/webserver/nginx/html/
shell> tar xzvf cacti-version.tar.gz
2. 创建数据库
shell> mysqladmin --user=root create cacti
3. 导入数据
shell> mysql cacti < cacti.sql
4. 创建cacti用户
shell> mysql --user=root mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;
5. 剪辑 include/config.php 文件,更改数据库连接
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "somepassword";
6. 配置nginx.conf
server {
listen 80;
root html; #apps下面有cacti目录
index index.php index.html;
location ~.*\.(php|php5)?$ {
root html; #apps下面有cacti目录
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
7.增加www的权限
chown -R /usr/local/webserver/nginx/html/cacti/log /usr/local/webserver/nginx/html/cacti/raa
*/5 * * * * php /usr/local/webserver/nginx/html/cacti/poller.php > /dev/null 2>&1
8. 浏览器访问:
http://your-server/cacti/
进入安装界面
安装完成,就可以使用了,默认用户名:admin密码:admin