9月 082011
 

1.系统的安装
这次我用的是CentOS5.5-i386,在选择安装包时一个包都不需要装,就以最小系统。配置好IP等。
A.关闭SElinux

vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.

SELINUX=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

把SELINUX=enforcing改为SELINUX=disabled并保存!在这个时候SElinux还在运行我们用

setenforce 0

来关闭SElinux

B.防火墙
一般我都是把防火墙直接关掉

/etc/init.d/iptables stop
/etc/init.d/ip6tables stop
chkconfig iptables off
chkconfig ip6tables off

2.配置cacti需要的软件环境
A.由于一些包在官方的库中没有,因此我们要建立dag.repo,定义非官方库

vi /etc/yum.repos.d/dag.repo

内容如下

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

然后再导入非官方库的GPG:

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

B.安装cacti需要的环境包

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

C.为cacti创建数据库和用户

service mysqld start
/usr/bin/mysqladmin --user=root create cacti
mysql -e "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactifans.org'"

3.下载cacti-0.8.7g.tar.gz并解压、MV

cd /var/www/html/
yum install wget -y
wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
tar xf cacti-0.8.7g.tar.gz
rm -rf cacti-0.8.7g.tar.gz
cd cacti-0.8.7g/
mv * ../
cd ..
rm -rf cacti-0.8.7g/
mysql -ucactiuser -pcactifans.org cacti < /var/www/html/cacti.sql

修改cacti的配置文件并保存

vi /var/www/html/include/config.php
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactifans.org";
$database_port = "3306";

设置crontab定时任务
由于我们是最小系统安装没有安装定时任务,因此我们首先安装

yum install vixie-cron

然后我们添加定时任务

echo '*/5 * * * * root /usr/bin/php /var/www/html/poller.php' >> /etc/crontab

设置服务开机自启动,重启服务

chkconfig snmpd on
chkconfig httpd on
chkconfig mysqld on
chkconfig crond on
service httpd restart
service snmpd restart
service mysqld restart
service crond restart

4.WEB页完成安装
浏览http://xxx.xxx.xxx.xxx/index.php
就可以出再Cacti Installation Guide的页面了。NEXT–NEXT–FINISH。
用户名和密码为:admin/admin,之后输入新的密码,就完成了最基本的安装。

打赏
 Posted by at 下午 8:52

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)