cacti简介:Cacti是一套基于PHP、MySQL、SNMP、及RRDTool开发的网络流量监测图形分析工具。它通过snmp来获取数据,使用 RRDtool绘画图形,而且你完全可以不需要了解RRDtool复杂的参数。它提供了非常强大的数据和用户管理功能,可以指定每一个用户能查看树状结 构、host以及任何一张图,还可以与LDAP结合进行用户验证,同时也能自己增加模板,功能强大,界面友好。
所需软件包:
httpd-2.2.6.tar.gz
mysql-5.0.27.tar.gz
php-5.2.6.tar.bz2
cacti-0.8.7g.tar.gz
phpmyadmin.tar.gz
rrdtool-1.4.3.tar.gz
--------------------------------------
一、环境配置:
#yum -y install gcc gcc-c++ glibc glibc-devel gd gd-devel zlib zlib-devel libtool-ltdl-devel flex autoconf automake libpng libpng-devel libjpeg libjpeg-devel freetype freetype-devel libxml2 libxml2-devel
二、安装apache
#tar zxvf httpd-2.2.6.tar.gz
#cd httpd-2.2.6
#./configure --prefix=/usr/local/apache --enable-so --enable-rewrite
#make && make install
#/usr/local/apache/bin/apachectl start
让apache开机自动启动:
方法一:
#echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local
方法二:
#ln -s /usr/local/apache/bin/apachectl /etc/init.d/httpd
#vi /etc/init.d/httpd 添加如下内容:
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.
# processname: apache
添加 apache 为系统服务(开机启动)
#chkconfig --add httpd
#chkconfig httpd on
三、安装mysql数据库
#useradd mysql
#tar zxvf ncurses-5.6.tar.gz
#cd ncurses-5.6
#./configure
#make && make install
#cd ..
#tar zxvf mysql-5.0.27.tar.gz
#cd mysql-5.0.27
#./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-#mysqld-user=mysql --enable-static --with-charset=gbk
#chown mysql -R /usr/local/mysql
#cd /usr/local/mysql/
#./bin/mysql_install_db --user=mysql
#chgrp -R mysql /var/lib/mysql/
#chown root:mysql -R /usr/local/mysql/
#cp share/mysql/my-medium.cnf /etc/my.cnf
#cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
#chmod 755 /etc/rc.d/init.d/mysqld
#chkconfig --add mysqld
#/etc/rc.d/init.d/mysqld start
#/etc/rc.d/init.d/mysqld restart
#./bin/mysqladmin -u root password 123456
开机自动启动mysql服务:
#echo "/usr/local/mysql/bin/mysqld_safe --user=mysql &" >> /etc/rc.local
#echo "export PATH=$PATH:/usr/local/mysql/bin" >>/etc/profile
#source /etc/profile
四、安装php5
#tar jxvf php-5.2.6.tar.bz2
#cd php-5.2.6
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir --enable-sockets
#make && make install
#ln -s /usr/local/php/bin/* /usr/local/bin/
#cp php.ini-dist /usr/local/php/lib/php.ini
修改apache主配置文件
#vi /usr/local/apache/conf/httpd.conf
添加修改如下:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php5 .php5
AddType application/x-httpd-php5-source .phps
修改
DirectoryIndex index.html
为:
DirectoryIndex index.html index.php
现在就可以测试了:
在htdocs目录下建立index.php内容如下:
phpinfo();
?>
重启apache服务
客户端测试:
----------------------------------------------
五、安装cacti:
#tar zxvf cacti-0.8.7g.tar.gz
#mv cacti-0.8.7g /usr/local/apache/htdocs/cacti
#cd /usr/local/apache/htdocs/cacti/
#mysql -uroot -p123456
#mysql>create database cacti; //创建cacti数据库
#mysql> insert into mysql.user (host,user,password) values ('localhost','cacti',password('cacti')); //建立用户cacti,密码cacti
#mysq>flush privileges; //重载MySQL授权表
#mysql>grant all on cacti.* to cacti@'localhost' identified by 'cacti'; //把数据库cacti授权于用户cacti
#cd /usr/local/apache/htdocs/cacti/
#mysql -ucacti -pcacti cacti < acti.sql //导入cacti数据库
导入完数据库我们还需要修改一下网站的配置文件,以保网站与数据库能正常连接
#vi include/config.php 修改成如下:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
#service mysqld restart
六、安装rrdtool和snmp服务:
#yum -y install net-snmp*
#tar zxvf rrdtool-1.4.3.tar.gz
#cd rrdtool-1.4.3
#./configure --prefix=/usr/local/rrdtool
#make && make install
#ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
cacti最总测试
默认的账号:admin密码:admin
它会强制你修改密码。
阅读(1084) | 评论(1) | 转发(0) |