[root@centos53 /]# yum list | grep cacti
安装httpd、Mysql、Cacti、Cacti-spine、net-snmp
(httpd和net-snmp可以已经安装,可以一次性安装:
[root@centos53 /]# yum -y install httpd mysql-server cacti cacti-spine net-snmp
)
安装httpd [root@centos53 /]# yum -y install httpd
安装mysql [root@centos53 /]# yum -y install mysql-server
安装cacti [root@centos53 /]# yum -y install cacti
安装cacti-spine [root@centos53 ~]# yum -y install cacti-spine
安装net-snmp [root@centos53 ~]# yum -y install net-snmp
相关配置
httpd的配置
[root@centos53 /]# vi /etc/httpd/conf/httpd.conf
更改或增加:
ServerName xxx.xxx.xxx.xxx
AddDefaultCharset GB2312
会发现我们并没有做“httpd和php整合”,以及对cacti的访问目录的相关配置,如有这个疑问,请注意httpd.conf中以下这行配置:
Include conf.d/*.conf
这个目录下的cacti.conf和php.conf等也是httpd.conf配置中的一部分,这两个配置文件就是对“httpd和php整合”,以及对cacti的访问目录的相关配置。
修改cacti.conf
[root@centos53 /]# vi /etc/httpd/conf.d/cacti.conf
相关行改成:
# deny from all
allow from all
本机net-snmp的配置
[root@centos53 /]# vi /etc/snmp/snmpd.conf
更改配置如下:
com2sec notConfigUser localhost public
access notConfigGroup "" any noauth exact all none none
view all included .1 80
mysqld的配置
[root@centos53 ~]# service mysqld start
[root@centos53 ~]# mysql -uroot
mysql> select user,host,password from mysql.user;
mysql> delete from mysql.user where user='';
mysql> select user,host,password from mysql.user;
mysql> set password for ");
mysql> create database cactidb;
mysql> grant all on cactidb.* to ;
mysql> grant all on cactidb.* to ;
mysql> set password for ");
mysql> flush privileges;
mysql> select user,host,password from mysql.user;
mysql> show databases;
mysql> exit
cacti的配置
[root@centos53 /]# cd /var/www/cacti/
[root@centos53 cacti]# mysql --user=root --password=rootpw cactidb
[root@centos53 cacti]# vi /var/www/cacti/include/config.php
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactipw";
$database_port = "3306";
[root@centos53 cacti]# chown cacti rra/ log/
设置crontab定时任务
[root@centos53 cacti]# vi /etc/crontab
*/5 * * * * cacti /usr/bin/php /var/www/cacti/poller.php > /dev/null 2>&1
设置服务开机自启动
[root@centos53 /]# chkconfig snmpd on
[root@centos53 /]# chkconfig httpd on
[root@centos53 /]# chkconfig mysqld on
重启服务
[root@centos53 /]# service httpd restart
[root@centos53 /]# service snmpd restart
[root@centos53 /]# service mysqld restart
后话
浏览/cacti/index.php或
就可以出再Cacti Installation Guide的页面了。NEXT--NEXT--FINISH。
用户名和密码为:admin/admin,之后输入新的密码,就完成了最基本的安装。
-----------------------------------------------
安装cacti时,在导入cacti.sql 这个文件时报错:
The command "mysql -u root -p cacti < cacti.sql' gets the following error:
ERROR 1064 (42000) at line 5: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 6
原因是mysql5这后不再支持 TYPE=MyISAM 这样的语法了,改成 ENGINE=MyISAM 就可以了
阅读(1816) | 评论(0) | 转发(0) |