分类: LINUX
2008-12-15 13:11:11
#mkidr /opt/distfiles
#cd /opt/distfiles
下载apache
#wget
下载php
#wget
下载mysql
#wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-
下载 rrdtools
#wget ftp://ftp.pucpr.br/rrdtool/rrdtool-
下载 cacti
#wget
#cd /home/xujj
#tar zxvf httpd-
./configure \
--prefix=/opt/modules/apache2 \
--enable-so \
--enable-modules=all \
--enable-mods-shared=all
#make&&make install
#tar zxvf mysql-
#cd mysql5-1.26
./configure \
--prefix=/opt/modules/mysql5 \
--with-mysqld-user=mysql \
--without-debug \
--with-big-tables \
--with-charset=latin1 \
--with-collation=latin1_swedish_ci \
--with-extra-charsets=all \
--with-pthread \
--enable-static \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-assembler \
--without-ndb-debug
#make &&make install
添加管理帐号
#groupadd mysql
#useradd mysql
#/opt/modules/mysql5/bin/mysql_install_db
#chown -R mysql.mysql /opt/modules/mysql5/var/
#/opt/modules/mysql5/share/mysql/mysql.server start
#/opt/modules/mysql5/bin/mysqladmin -u root password 'sqlcacti@cernet'
测试:
#/opt/modules/mysql5/bin/mysql -uroot -psqlcacti@cernet
#tar zxvf php-
#cd php-
#apt-get install libsnmp-dev
./configure \
--prefix=/opt/modules/php \
--with-apxs2=/opt/modules/apache2/bin/apxs \
--enable-sockets \
--with-mysql=/opt/modules/mysql5/ \
--with-zlib-dir \
--with-pdo-mysql=/opt/modules/mysql5 \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--with-iconv-dir \
--enable-bcmath \
--with-ttf \
--with-openssl \
--enable-sqlite-utf8 \
--with-gd \
--with-snmp \
--enable-mbstring
#make && make install
#ln -s /opt/modules/php/bin/* /usr/bin/
添加数据库cactidb
#/opt/modules/mysql5/bin/mysql -uroot -psqlcacti@cernet
mysql>create database cactidb;
mysql>GRANT ALL PRIVILEGES ON cactidb.* TO cactiuser@'localhost' IDENTIFIED mysql>BY'cacti%^$' WITH GRANT OPTION;
mysql>flush privileges;
说明:由于rrdtool默认不支持中文出图,所以需要对rrdtool的源码进行修改以便让其支持中文出图
#cd /opt/distfiles/
#tar zxvf rrdtool-
#vi rrdtool-
修改下面的东西:(建议在windows下修改)
行51: {60, 24*3600, TMT_MINUTE,30, TMT_HOUR,2, TMT_HOUR,4, 0,"%d日(%H:%M)"},
行53: {180, 24*3600, TMT_HOUR,1, TMT_HOUR,6, TMT_HOUR,12, 0,"%d日(%H:%M)"},
行55: {600, 0, TMT_HOUR,6, TMT_DAY,1, TMT_DAY,1, 24*3600,"周%a(%d日)"},
行56: {1200, 0, TMT_HOUR,6, TMT_DAY,1, TMT_DAY,1, 24*3600,"%d日"},
行57: {1800, 0, TMT_HOUR,12, TMT_DAY,1, TMT_DAY,2, 24*3600,"周%a(%d日)"},
行58: {2400, 0, TMT_HOUR,12, TMT_DAY,1, TMT_DAY,2, 24*3600,"周%a(%d日)"},
行59: {3600, 0, TMT_DAY,1, TMT_WEEK,1, TMT_WEEK,1, 7*24*3600,"%V周"},
行60: {3*3600, 0, TMT_WEEK,1, TMT_MONTH,1, TMT_WEEK,2, 7*24*3600,"%V周"},
行3065: //setlocale(LC_TIME,"");
行3066: #ifdef HAVE_MBSTOWCS
行3067: setlocale(LC_ALL,"zh_CN"); //zh_CN,zh_CN.GB2312,zh_CN.UTF-8都可以
说明:行数可能有所出入,其实就是将其中英文表示的地方修改为了中文
#./configure --prefix=/usr/local/rrdtool
#make
#make install
#ln –s /usr/local/rrdtool/bin/* /usr/bin/
#cd /opt/distfiles/
#tar zxvf cacti-
注:将解开的目录copy到apache能访问到的目录就可以了。
如:
#cp –r cacti-
#cd /home/www/cacti
导入数据库:
#/opt/modules/mysql5/bin/mysql –ucactiuser -p cacti%^$ cactidb<./cacti.sql
#vi include/config.php
#vi include/global.php
注:将数据库修改为前面能访问的数据库就可以了
通过你的虚拟主机或IP访问cacti,如:
http://
之后通过提示进行安装即可
安装中文系统支持
#dpkg-reconfigure locales
配置环境变量:
#vi /root/.bashrc 加入
export LANG='zh_CN.gb2312'
#apt-get install libsnmp15 libsnmp-base libsnmp-dev snmp libsnmp-perl snmpd
#wget
#tar zxvf ttf-arphic-ukai_0.1.20060928.orig.tar.gz
#cd ttf-arphic-ukai_0.1.20060928
#cp ukai.ttf /usr/share/fonts/zh_CN/
说明:也可以将windows的中文字体,推荐用黑体,拷贝到系统的/usr/share/fonts/zh_CN/下,没有就自己创建一个,之后在cacti的setting的path中将rrdtool的字体路径设置为中文字体的路径。
说明:修改 output_buffering 设为 on
#wget
#wget
#wget
#wget
#tar -zxvf xxx.tar.gz
#cd xxx
#ls –alh
说明:如果有xxx.sql文件,一般都需要导入到cacti的数据库中
#cd cacti目录
#wget
#wget 0.8.7b/snmp_auth_none_notice.patch
#wget 0.8.7b/reset_each_patch.patch
#patch -p1 -N < upgrade_from_086k_fix.patch
#patch -p1 -N < snmp_auth_none_notice.patch
#patch -p1 -N < reset_each_patch.patch
#vi cacti 目录/include/global.php
找到//$config['url_path'] = '/';
修改
$config['url_path'] = '/';
说明:如果是通过访问就要修改为$config['url_path'] = '/cacti/';
如果是通过访问就不用修改
# mv xxx cacti目录/plugins/
#vi cacto目录/include/global.php
找到$plugins = array();
再在下面增加
$plugins[] = 'xxx';
通过web方式访问cacti,对插件进行设置
#cd /opt/distfiles
#tar zxvf monitor.tar.gz
#cd monitor
#/opt/modules/mysql5/bin/mysql –uroot –pxxx cacti <./monitor.sql
#mv monitor /home/www/plugins/
#vi /home/www/cacti/include/gloabe.php
找到$plugins = array();
在其下面添加
$plugins[] = 'monitor';
打开web页面对monitor进行管理
#cd /opt/distfiles
#tar zxvf setting.tar.gz
#mv setting /home/www/cacti/plugins/
#vi /home/www/cacti/include/gloabe.php
找到$plugins = array();
在下面增加
$plugins[] = 'settings';
登陆配置插件
安装thold
安装weathermap