centos5部署cacti

安装扩展源:
访问https://fedoraproject.org/wiki/EPEL/zh-cn,选择相应的epel-release'包
安装:
wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5-4.noarch.rpm

安装必要软件:
yum -y install httpd php php-mysql php-snmp mysql mysql-server perl-DBD-MySQL php-pdo net-snmp net-snmp-libs net-snmp-utils

安装RRDtool工具:
yum -y install php-gd rrdtool-perl rrdtool

修改apache配置文件:
vi /etc/httpd/conf/httpd.conf
#找到AddType添加如下二行:
AddType application/x-httpd-php  .php
AddType application/x-httpd-php-source  .phps
#定位至DirectoryIndex index.html
修改为:
DirectoryIndex  index.php  index.html

请使用以下命令使其开机自启动:
chkconfig --level 35 mysqld on
chkconfig --level 35 httpd on
chkconfig --level 35 snmpd on

启动mysql与http服务:
service mysqld start
service httpd start

修改系统中的snmp设置:
vi /etc/snmp/snmpd.conf

com2sec notConfigUser default public
改为:
com2sec notConfigUser 127.0.0.1 public

access  notConfigGroup ""  any   noauth    exact  systemview  none none
改为:
access  notConfigGroup ""  any noauth exact all none none
#view all    included  .1         80
将前面的#注释去掉。

重新启动snmp服务:
service snmpd restart

下载安装cacti:
wget http://www.cacti.net/downloads/cacti-0.8.7i.tar.gz
tar xzf cacti-0.8.7i.tar.gz
mv cacti-0.8.7i /var/www/html/cacti

建立数据库:
mysqladmin --user=root create cacti
mysql cacti < cacti.sql

设置mysql数据库root密码:
mysqladmin --user=root password somepassword
mysqladmin --user=root --password reload

创建cacti用户和密码:
useradd -d /var/www/html/cacti cactiuser
mysql --user=root mysql
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';
flush privileges;

修改配置文件:
vi /var/www/html/cacti/include/config.php

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";

设置文件访问权限:
cd /var/www/html/cacti
chown -R apache.apache /var/www/html/cacti/
chown -R cactiuser.cactiuser rra/ log/

添加计划任务:
vi /etc/crontab
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

登陆cacti进行设置:
http://your-server/cacti/

本文出自 “share” 博客,谢绝转载!

你可能感兴趣的:(centos,职场,cacti,休闲)