89ou 发表于 2019-1-11 11:27:32

CentOS5.5上用yum方式安装Cacti

  1、首先,激活额外的yum源
  # yum install yum-priorities
# wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# rpm -K rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
  2、配置MySQL、Apache、PHP环境
  
1)使用yum或者使用安装盘rpm -ivh 的方式安装以下软件

[*]httpd
[*]php
[*]php-mysql
[*]php-snmp
[*]php-ldap (when using LDAP authentication)
[*]php-xml
[*]mysql
[*]mysql-server
[*]net-snmp (depending on the distro, net-snmp-utils may be required)
[*]crond (cron, cronie or the like)

  2)设置http 和 mysql服务器自动启动,同时开启两个服务
  # chkconfig mysqld on
# chkconfig httpd on
# service mysqld start
# service httpd start
  3)准备数据库
# mysqladmin -uroot -p create cacti
# mysql -uroot -p
mysql>grant all on cacti.* to cactiuser@localhost identified by 'cactiuser';
mysql>flush privileges;
mysql>exit
  4)设置PHP,HTTP,SNMP等
         按官方手顺设置:http://www.cacti.net/index.php
  3、安装配置Cacti
  1)安装:
# yum -y install cacti
这步结束后,它会自动添加cacti系统用户
# grep cacti /etc/passwd
cacti:x:100:101:cacti:/var/www/cacti:/bin/sh
  为安全起见,改变cacti的shell
  vi /etc/passwd
  将
  cacti:x:100:101:cacti:/var/www/cacti:/bin/sh
  修改为
  cacti:x:100:101:cacti:/var/www/cacti:/bin/false
  保存退出
  还会自动添加计划任务
  # cat /etc/cron.d/cacti
*/5 * * * * cacti php /var/www/cacti/poller.php &>/dev/null
  启动snmpd
# chkconfig snmpd on
# service snmpd start
  2) 配置
  默认cacti目录被安装到了/var/www目录下,我把这个目录移到了/var/www/html目录下
  同时将/etc/httpd/conf.d目录下的cacti.conf 删掉,同时将计划任务由原来的
  */5 * * * * cacti php /var/www/cacti/poller.php &>/dev/null改为
  */5 * * * * cacti php /var/www/html/cacti/poller.php &>/dev/null
  然后重启crond和httpd服务。
  4.导入数据,修改数据连接信息
  导入数据信息
# cd /var/www/html/cacti
# mysql -ucactiuser -pcactiuser cacti < cacti.sql
  修改数据库连接信息
# vim /var/www/cacti/include/config.php
  $database_type = &quot;mysql&quot;;
$database_default = &quot;cacti&quot;;
$database_hostname = &quot;localhost&quot;;
$database_username = &quot;cactiuser&quot;;
$database_password = &quot;cactiuser&quot;;
$database_port = &quot;3306&quot;;
  5.测试安装是否正常
打开下面的url.
  http://server.ip.or.name/cacti
  打开网站,点next.选择new install,使用一路回车法.最后完成
最后的用户名为: admin 密码为: admin
第一次登陆,会强制要求修改密码
  8.收尾
如果监控设备很多,可以考虑使用spine方式来获取数据。
  可官网参考spine的安装设置



页: [1]
查看完整版本: CentOS5.5上用yum方式安装Cacti