Chinaunix首页 | 论坛 | 博客
  • 博客访问: 652795
  • 博文数量: 98
  • 博客积分: 3145
  • 博客等级: 中校
  • 技术积分: 1902
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-15 12:52
文章分类
文章存档

2021年(1)

2020年(1)

2016年(8)

2015年(3)

2014年(1)

2013年(5)

2012年(4)

2011年(9)

2010年(12)

2009年(42)

2008年(12)

我的朋友

分类: LINUX

2008-12-15 13:11:11

下载安装文件

#mkidr /opt/distfiles

#cd /opt/distfiles

下载apache

#wget 2.2.8.tar.gz

下载php

#wget 5.2.6.tar.gz/from/cn.php.net/mirror

下载mysql

#wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.26-rc.tar.gz/from/

下载 rrdtools

#wget ftp://ftp.pucpr.br/rrdtool/rrdtool-1.2.26.tar.gz

下载 cacti

#wget 0.8.7b.tar.gz

安装apache+php+mysql环境

安装apache

#cd /home/xujj

#tar zxvf httpd-2.2.8.tar.gz

 

./configure \

--prefix=/opt/modules/apache2 \

--enable-so \

--enable-modules=all \

--enable-mods-shared=all

 

#make&&make install

安装mysql

#tar zxvf mysql-5.1.26-rc.tar.gz

#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

安装php5

#tar zxvf php-5.2.6.tar.gz

#cd php-5.2.6

#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/

配置mysql数据库

添加数据库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源码包

说明:由于rrdtool默认不支持中文出图,所以需要对rrdtool的源码进行修改以便让其支持中文出图

 

#cd /opt/distfiles/

#tar zxvf rrdtool-1.2.26.tar.gz

#vi rrdtool-1.2.26/src/rrd_graph.c

修改下面的东西:(建议在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/

安装cacti

解压cacti安装包

#cd /opt/distfiles/

#tar zxvf cacti-0.8.7b.tar.gz

 

注:将解开的目录copyapache能访问到的目录就可以了。

如:

#cp –r cacti-0.8.7b  /home/www/cacti

配置cacti

#cd /home/www/cacti

导入数据库:

#/opt/modules/mysql5/bin/mysql –ucactiuser -p cacti%^$ cactidb<./cacti.sql

#vi include/config.php

#vi include/global.php

 

注:将数据库修改为前面能访问的数据库就可以了

 

安装cacti

通过你的虚拟主机或IP访问cacti,如:

http://10.0.0.1/cacti/

之后通过提示进行安装即可

可能需要配置的地方

系统需要配置支持中文

安装中文系统支持

#dpkg-reconfigure locales

配置环境变量:

#vi /root/.bashrc 加入

export LANG='zh_CN.gb2312'

安装snmp-server

#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/下,没有就自己创建一个,之后在cactisettingpath中将rrdtool的字体路径设置为中文字体的路径。  

 

 

6.安装插件

6.1准备工作

6.1.1修改php.ini

说明:修改 output_buffering 设为 on

6.1.2下载源文件

#wget

#wget

#wget

#wget

6.2安装插件通用方法

6.2.1 解开源码包

#tar -zxvf xxx.tar.gz

#cd xxx

6.2.2 查看文件

#ls –alh

 

说明:如果有xxx.sql文件,一般都需要导入到cacti的数据库中

6.2.3 安装插件补丁

#cd cacti目录

#wget 0.8.7b/upgrade_from_086k_fix.patch
#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/';

如果是通过访问就不用修改

 

6.2.4 安装插件

# mv  xxx  cacti目录/plugins/

#vi cacto目录/include/global.php

找到$plugins = array();

再在下面增加

$plugins[] = 'xxx';

6.2.5 配置插件

通过web方式访问cacti,对插件进行设置

6.3安装插件实例

6.3.1 安装monitor

#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进行管理

6.3.2安装settings

#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

阅读(1676) | 评论(0) | 转发(0) |
0

上一篇:MYSQL调优文档2

下一篇:常用DNS列表

给主人留下些什么吧!~~