CentOS 5.5下 Cacti安装部署(新版本)
Cacti也安装部署了很多次,而每次部署完之后,却都没有做一个总结,当再次部署之时,又有些遗忘,还得查找一些有用的资料,这次部署了一次,顺便也写个总结文档,方便以后再次需要!!!!本次部署按照最简洁要求部署。
Cacti版本:cacti-0.8.7g 系统版本:CentOS-5.5-2.6 i386平台
一、安装cacti所需要的环境(mysql、mysql-server、httpd、php、php-mysql)-此部署环境并没有默认安装mysql,php,httpd等
yum install mysql ##同时会下载安装perl-DBI
yum install mysql-server ##同时会下载安装perl-DBD-MySQL
yum install httpd
yum install php ##会同时下载安装php-cli ,php-common
yum install php-mysql ##会同时下载安装php-pdo
二、 安装cacti所需要的大量的库
zlib: yum install zib
libpng: yum install libpng
freetype: yum install freetype
jpeg: yum install libjpeg
fontconfig: yum install fontconfig
gd: yum install gd
libxml: yum install libxml2
三、安装绘图所需的rrdtool,以rpm方式安装(根据不同的环境选择不同的rrdtool版本)
#wget http://www.express.org/~wrl/rrdtool/rrdtool-1.2.30-1.el5.wrl.i386.rpm
#wget http://www.express.org/~wrl/rrdtool/rrdtool-perl-1.2.30-1.el5.wrl.i386.rpm
#rpm -ivh rrdtool-1.2.30-1.el5.wrl.i386.rpm rrdtool-perl-1.2.30-1.el5.wrl.i386.rpm
安装snmp的支持工具
#yum install net-snmp
#yum install net-snmp-utils
四、下载安装cacti
#wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
#tar -xvzf cacti-0.8.7g.tar.gz
#cd /usr/local/cacti
#vim include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$config['url_path'] = '/cacti/';
添加一个cacti用户,并将cacti的安装目录所属用户改为cacti用户
#useradd cacti -d /usr/local/cacti
#chown –R cacti /usr/local/cacti
#chgrp –R cacti /usr/local/cacti
#chmod –R 755 /usr/local/cacti
配置cacti数据库
#chkconfig mysqld on ##设置为开机启动
#/etc/init.d/mysqld start
#/usr/bin/mysqladmin -uroot -p password "jiuzhou"
#/usr/bin/mysql –uroot –p
mysql> create database cacti;
mysql> use mysql;
mysql> grant all privileges on cacti.* to 'cacti'@'localhost' identified by 'cacti';
mysql> flush privileges;
mysql> exit
导入cacti的sql文件
# /usr/bin/mysql -uroot -p cacti < /usr/local/cacti/cacti.sql
配置apache
新建文件:#vim /etc/httpd/conf.d/cacti.conf
Alias /cacti /usr/local/cacti
<Directory "/usr/local/cacti">
DirectoryIndex index.php
AllowOverride None
order deny,allow
deny from all
allow from all
AddType application/x-httpd-php .php
php_flag magic_qutoes_gpc on
php_flag track_vars on
</Directory>
然后修改vi /etc/httpd/conf/httpd.conf
Listen 88 ##本人修改web访问端口为88,是否需要更改,根据自己情况而定
DirectoryIndex index.html index.php index.html.var
设置apache开机启动,并启动apache服务
#chkconfig httpd on
如果改了站点默认的路径/var/www/html的话,那么httpd.conf里还有两处地方也许改动
#service httpd start
建一个php测试页,如果能返回php的一些配置信息则表明配置成功,如下: