环境:

centos 6.5 -x64

cacti-0.8.7e.tar.gz

mysql yum安装即可

yum服务使用centos自带的就行.如果是红帽请自行解决yum.本文不赘述.

**注意:同步好服务器的时间.免得后面加上监控服务器不出图.

安装软件

yum -y install httpd php php-mysql zlib freetype libjpeg fontconfig gd libxml2 zlib freetype libjpeg fontconfig gd libxml2 php-gd  rrdtool rrdtool-devel net-snmp net-snmp-devel net-snmp-utils mysql-server

配置snmp

1 vim /etc/snmp/snmpd.conf
2 com2sec notConfigUser default public
3 改为:com2sec notConfigUser 127.0.0.1 public
4 access notConfigGroup "" any noauth exact systemview none none
5 改为:access notConfigGroup "" any noauth exact all none none
6 #view all included .1 80 去掉注释

启动服务并加如开机启动

service httpd start
service mysqld start
service snmpd start
chkconfig httpd on
chkconfig mysqld on
chkconfig snmpd on

安装cacti

wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
tar zxf cacti-0.8.7e.tar.gz -C /var/www/html/
cd /var/www/html/
mv cacti-0.8.7e/ cacti

初始化数据库

yum安装cacti-LMLPHP
1 # mysql -u root
2 mysql> create database cacti;
3 mysql> grant all on cacti.* to cacti@localhost identified by 'cacti';
4 mysql> grant all on cacti.* to cacti@'127.0.0.1' identified by 'cacti';
5 mysql> flush privileges;
6 mysql> use cacti;
7 mysql> source /var/www/html/cacti/cacti.sql;
8 mysql> quit
yum安装cacti-LMLPHP

配置cacti

yum安装cacti-LMLPHP
1 vim /var/www/html/cacti/include/config.php
2 $database_type = "mysql";
3 $database_default = "cacti";
4 $database_hostname = "localhost";
5 $database_username = "cacti";
6 $database_password = "cacti";
7 $database_port = "3306";
8
9 把配置文件里改成和这里一样的就可以了.
yum安装cacti-LMLPHP

设置相关权限和计划任务.

useradd cacti -d /var/www/html/cacti -s /sbin/nologin
chown -R cacti /var/www/html/cacti/rra /var/www/html/cacti/log
echo '*/5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1' >> /etc/crontab

初始化cacti

访问你的cacti.地址如下.红色替换成你的服务器ip

http://192.168.0.105/cacti

yum安装cacti-LMLPHP

如果显示的页面和这个一样.说明你前面配置的没有问题了.

直接点击next>>

yum安装cacti-LMLPHP

如果都显示ok则可以点击finish.如果有not found 则要看看是哪个命令或者路径不对.

finsh之后就是登录界面了,用户名和密码都是admin.

yum安装cacti-LMLPHP

第一次登录需要修改密码.如下

yum安装cacti-LMLPHP

填入新密码保存即可.

这样cacti就安装完成了.

不过这个版本的cacti太老了~~~

The latest stable version is 1.1.36, released 02/25/18.而且需要mysql5.6

其实不还不会装~~~主要是依赖关系懒得去看!还要调整mysql的参数~~~~哈哈~~~

不过如果有机会的话还是用cactiEZ更简单

05-11 17:24