CentOS下配置Cacti
库的编译安装:
安装完后,执行rrdtool看是否正确,
如果执行不成功,提示命令不存在,则需要将所有RRDTool的可执行文件,拷到/usr/local/bin
- #cp /usr/local/rrdtool/bin/* /usr/local/bin
Building apache
- cd /usr/local/src
- wget [url=http://linux.chyangwa.com/apache/httpd-2.0.61.tar.gz]http://linux.chyangwa.com/apache/httpd-2.0.61.tar.gz[/url]
- tar zxfv httpd-2.0.61.tar.gz
- cd httpd-2.0.61
- ./configure --prefix=/usr/local/apache
- make ; make install
Building Mysql
- cd /usr/local/src
- wget [url=http://linux.chyangwa.com/MySQL/mysql-max-4.0.27-pc-linux-gnu-i686-glibc23.tar.gz]http://linux.chyangwa.com/MySQL/mysql-max-4.0.27-pc-linux-gnu-i686-glibc23.tar.gz[/url]
- tar zxvf mysql-max-4.0.27-pc-linux-gnu-i686-glibc23.tar.gz
- mv mysql-max-4.0.27-pc-linux-gnu-i686-glibc23 /usr/local/mysql
- groupadd mysql ; useradd -g mysql mysql
- cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
- cd /usr/local/mysql
- scripts/mysql_install_db --user=mysql
- chown -R root .
- chown -R mysql data
- chgrp -R mysql .
- /usr/local/mysql/bin/mysqld_safe --user=mysql &
#p#
Building PHP
- cd /usr/local/src
- wget [url=http://linux.chyangwa.com/PHP/php-5.0.5.tar.gz]http://linux.chyangwa.com/PHP/php-5.0.5.tar.gz[/url]
- tar zxfv php-5.0.5.tar.gz
- cd php-5.0.5
- ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --enable-snmp
- make; make install
- cp php.ini-dist /usr/local/lib/php.ini
编辑 /usr/local/apache/conf/httpd.conf
查找 DirectoryIndex index.htm
修改成 DirectoryIndex index.htm index.php
查找
- AddType application/x-gzip .gz .tgz
添加
- AddType application/x-httpd-php .php
- ServerName test.liba.com
- AddDefaultCharset gb2312
- NameVirtualHost *:80
- ServerAdmin [url=mailto:chyangwa@liba.com]chyangwa@liba.com[/url]
- DocumentRoot /www1/clubfiles
- ServerName clubfiles.liba.com
Building cgilib
- tar zxvf cgilib-0.5.tar.gz
- cd cgilib-0.5
- make CC=gcc CFLAGS="-O3 -fPIC -I."
- cp *.h /usr/include/
- cp libcgi* /usr/lib
Building zlibcp
- tar zxvf zlib-1.2.2.tar.gz
- cd zlib-1.2.2
- ./configure --prefix=/usr
- make
- make install
Building libpng
- tar zxvf libpng-1.2.8-config.tar.gz
- cd libpng-1.2.8-config
- cp scripts/makefile.gcmmx makefile
- ./configure --disable-shared --prefix=/usr
- make
- make install
Building freetype
- tar zxvf freetype-2.1.10.tar.gz
- cd freetype-2.1.10
- ./configure --disable-shared --prefix=/usr
- make
- make install
Building libart_lgpl
- tar zxvf libart_lgpl-2.3.17.tar.gz
- cd libart_lgpl-2.3.17
- ./configure --disable-shared --prefix=/usr
- make
- make install
Building gd 2.0.33
- cd /usr/local/src
- wget [url=http://linux.chyangwa.com/GD/gd-2.0.35.tar.gz]http://linux.chyangwa.com/GD/gd-2.0.35.tar.gz[/url]
- tar zxvf gd-2.0.35.tar.gz
- cd gd-2.0.35
- ./configure ; make ; make install
Building rrdtool-1.2.6
- tar zxvf rrdtool-1.2.6.tar.gz
- ./configure --prefix=/usr/local/rrdtool --disable-tcl
- make;make install
#p#
3.安装Net-SNMP(安装net-snmp-utils-5.1.2-11.EL4.11,net-snmp-5.1.2-11.el4_6.11.2,net-snmp-libs-5.1.2-11.EL4.7)
下载
- tar zxvf net-snmp-5.2.1.2.tar.gz
- cd net-snmp-5.2.1.2
- ./configure
- make
- make install
检查是否有/usr/bin下是否有snmpget,snmpwalk这两个文件
RPM包的snmpwalk的名称是:net-snmp-utils.*.rpm,也可以从安装光盘上RPM安装(rpm -Uhv --nodeps xxx.rpm)。
修改etc/snmp/snmp.conf
- # sec.name source community
- com2sec notConfigUser default public
将"comunity"字段改为你要设置的密码.比如"bizcnpublic".
将“default”改为你想哪台机器可以看到你的snmp信息,如10.10.10.10。授权服务器IP
2、查找以下字段:
- # Finally, grant the group read-only access to the systemview view.
- #group context sec.model sec.level prefix read write notif
- access notConfigGroup "" any noauth exact systemview none none
将"read"字段改为all.
- #access notConfigGroup "" any noauth exact all none none
3、查找以下字段:
- ## incl/excl subtree mask
- #view all included .1 80
将该行前面的"#"去掉.
4、查找以下字段:
- #name incl/excl subtree mask(optional)
添加一行view all included .1
变成
- #name incl/excl subtree mask(optional)
- view all included
4、查找一下字段:
- #view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
将该行前面的"#"去掉.
保存关闭.
4、运行service snmpd start命令运行snmpd.
5、如果有防火墙,打开UDP 161端口。
最后运行netstat -ln查看161端口是否打开了.
#p#
4.安装CACTI
a) 安装cacti源文件
下载cacti-0.8.6g.tar.gz
将这个压缩包解压到网站根目录
cp cacti-0.8.6g.tar.gz /home/wwwroot //httpd站点目录所在
- cd /home/wwwroot
- tar xzvf cacti-0.8.6g.tar.gz
- mv cacti-0.8.6g cacti
- (chown –R apache.apache cacti)
- cd cacti
b) 配置Mysql数据库
为cacti配置用户和数据库:
- mysql>create database cacti;
- mysql>GRANT ALL PRIVILEGES ON *.* TO [url=mailto:root@localhost]root@localhost[/url] IDENTIFIED BY '123456' with GRANT OPTION;
- mysql>quit
c) 配置Cacti连接数据库
- vi /home/wwwroot/cacti/include/config.php
- $database_type = “mysql”;
- $database_default = “cacti”;
- $database_hostname = “localhost”;
- $database_username = “root”;
- $database_password = “123456”;
d) 导入数据表
- /usr/local/mysql/bin/mysql -uroot -p cacti
- NEXT -》
输入一些信息,如rrdtool、php、snmpwalk、snmpget的位置,使用ucd-snmp还是net-snmp等-》
输入原始的用户和密码:admin/admin -》
更改admin用户的密码-》
点击 Save
注:一定要手动先执行
- /usr/local/mysql/bin/mysql -uroot -p cacti [/color]
【编辑推荐】