Cacti 0.8.7g在CentOS5.5上的安装(1)
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,之后输入新的密码,就完成了最基本的安装。