Redhat EL 5.3上安装Cacti(5)-安装/配置cacti
Linux下安装Cacti实现网络监控
由于博客字符8万限制,所以分开5部分上传! 请看Redhat EL 5.3上安装Cacti(1-5) 第五部分:安装/配置cacti
# wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
# tar zxvf cacti-0.8.7e.tar.gz
# mv cacti-0.8.7e /usr/local/apache22/htdocs/cacti
# chown -R root:root /usr/local/apache22/htdocs/cacti
在Mysql中创建新的database,导入cacti目录中的cacti.sq创建表:
# /usr/local/mysql/bin/mysql –u root –p
Enter Password:rootpw //安装mysql时设置的密码,默认为空
mysql> create database cacti;
mysql> use cacti;
mysql> source /usr/local/apache22/htdocs/cacti/cacti.sql;
设置数据库用户权限:
grant all on cacti.* to root;
grant all on cacti.* to root@localhost;
grant all on cacti.* to cactiuser;
grant all on cacti.* to cactiuser@localhost;
set password for cactiuser@localhost=password('cactipw');
编辑cacti的数据库配置文件,与上一步中的用户对应。
# vi /usr/local/apache22/htdocs/cacti/include/config.php
$database_type=“mysql”;
$database_default=“cacti”;
$database_hostname=“localhost”;
$database_username=“cactiuser”;
$database_password=“cactipw”;
打开浏览器http://IP地址/cacti
这里可能出现的error信息如下:You have created a new database, but have not yet imported the 'cacti.sql …
解决方法:出现这个错误是因为数据库用户的权限问题。如果按照我上面的用户创建及设置应该是不会出现这个error的。如果把$database_hostname换成IP,就会出现这个错误。当然如果给这个IP地址grant给用户权限后,就不会出错了!
例如:grant all on cactidb.* to cactiuser@ip; grant all on cactidb.* to root@ip;