# rpm -e httpd-2.2.3-63.el5.centos --nodeps //卸载软件包,--nodeps 如果有连带关系,也强制卸载
# cd /etc/httpd/
# rm -rf * // 删除原有httpd文件
php , mysql 卸载方法同上, 然后新安装LAMP
------------------------------------------ END LAMP ---------------------------------------
二、安装cacti所需环境
1. 安装rrdtool
# yum install rrdtool -y
2. 安装net-snmp
# yum install net-snmp net-snmp-libs net-snmp-utils
# vi /etc/snmp/snmpd.conf // 配置 snmpd.conf
view systemview included .1.3.6.1.2.1.1
改为:
view systemview included .1.3.6.1.2.1
# service snmpd start // 启动 snmpd 服务
# snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.1.1.0 // 测试net-snmp
SNMPv2-MIB::sysDescr.0 = STRING: Linux cronos 2.4.28 #2 SMP ven jan 14 14:12:01 CET 2005 i686
三.安装配置Cacti
1. 获取并解压缩Cacti文件
# cd /tmp
# wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
# tar -zxvf cacti-0.8.8b.tar.gz
# mv cacti-0.8.8b /var/www/html/cacti //将它放到WWW目录并改名
2. 创建Cacti数据库并建立访问帐号
# mysql -uroot -p123456
mysql> create database cacti;
mysql> grant all on cacti.* to root;
mysql> grant all on cacti.* to root@localhost;
mysql> grant all on cacti.* to cactiuser;
mysql> grant all on cacti.* to cactiuser@localhost;
mysql> set password for cactiuser@localhost=password('cactiuser');
mysql> quit
3. 导入Cacti数据库 , 创建用户并赋予权限
# cd /var/www/html/cacti
# mysql -uroot -p123456 cacti < cacti.sql
# useradd cactiuser -d /var/www/html/cacti -s /bin/false
# chown –R cactiuser /var/www/html/cacti/rra /var/www/html/cacti/log
4. 配置cacti数据库连接
# vim /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
# vim /var/www/html/cacti/include/global.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
5. 修改文件目录属性
chown -R root.root *
6. 建立调度任务
crontab –e
*/5 * * * * php /var/www/html/cacti/poller.php >/dev/null 2>&1
四.初始化
1. 登陆 http://localhost/cacti 访问cacti管理页面
由于开启了SeLinux导致权限问题
You don't have permission to access /cacti on this server.
因此,我们需要关闭 Selinux
1).查看SELinux状态:
# /usr/sbin/sestatus -v // 如果SELinux status参数为enabled即为开启状态
SELinux status: enabled
# getenforce //也可以用这个命令检查
2).关闭SELinux:
a、临时关闭(不用重启机器):
# setenforce 0 // 设置SELinux 成为permissive模式 (关闭SELinux)
# setenforce 1 // 设置SELinux 成为enforcing模式 (开启SELinux)
b、修改配置文件需要重启机器:
# vi /etc/selinux/config
将SELINUX=enforcing 改为SELINUX=disabled
重启机器即可reboot
3). 如果上面方法不行,我们还可以编辑cacti.conf
# vi /etc/httpd/conf.d/cacti.conf // 如果不存在,我们就手工创建一个,并加入下面代码
Alias /cacti "/var/www/html/cacti"
<Location "/cacti">
Order Deny,Allow
# Deny from all
Allow from 127.0.0.1
Allow from ::1
Options Indexes Includes FollowSymLinks
</Location>
# These directories do not require access over HTTP
#
<Directory "/var/www/html/cacti">
AllowOverride Limit
Options FollowSymLinks
</Directory>
2.选择全新安装
3.指定路径
4.默认登陆:用户 admin 密码:admin,强制更该密码
5. 检查相关软件路径
1)Settings—Paths路径
2)Settings—General—Required Tool Versions 选择 rrdtool 1.3.x
然后保存,此时便可以在Graphs 中看到localhost的图标。
到此,cacti安装完毕。
PS: 安装完后,使用的时候又有一堆问题, 直到后来百度了一下,发现了这个东西
CactiEZ:http://www.cngr.cn/dir/216/339/2013012092768.html
转载来源于:http://os.iyunv.com/art/201104/252883.htm
转载来源于:http://fmcpu.blog.163.com/blog/static/17603638820137154212424/