在Ubuntu下安装Cacti笔记

张森力作,大家学习!
系统:Ubuntu8.04MySQL5.0PHP5Apache2.2Snmprrdtool-1.2.27

Ubuntu的好处,咱不多说了就冲着他的apt-get 软件丰富,安装便捷。

一.环境:
apt-get install build-essentialgcc基本环境)
apt-get install flex
apt-get install libmysqlclient15-dev
apt-get install libtool
apt-get install libltdl3-dev
apt-get install libxml2-dev

二.安装MySQL
atp-get install mysql-server


一.安装Apache 、PHP5
sudo apt-get install apache2

sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo apt-get install php5-gd
sudo apt-get install php5-dev
sudo /etc/init.d/apache2 restart

完了之后还要让apache、php支持mysql

sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo /etc/init.d/apache2 restart
至此apache2+php 5+mysql5.0.51的环境就完成了

二.安装Snmp
sudo apt-get install snmp
这个没有什么特别
三.安装RRDTOOL
sudo apt-get install rrdtool
即可
不过这个RRD是不支持中文的,如果要支持,就只能用Src编译安装
安装rrdtool 之前需要4个文件:

freetype-2.3.5.tar.gz  libart_lgpl-2.3.17.tar.gz   zlib-1.2.3.tar.gz  libpng-1.2.18.tar.gz
rrdtool-1.2.27.tar.gz  这5个最好按照我给出的顺序

tar -zxvf freetype-2.3.5.tar.gz
tar -zxvf libart_lgpl-2.3.17.tar.gz
tar -zxvf zlib-1.2.3.tar.gz
tar -zxvf libpng-1.2.18.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr ; make ; make install
cd ../ libart_lgpl-2.3.17
./configure --prefix=/usr ; make ; make install
cd ../ zlib-1.2.3
./configure --prefix=/usr ; make ; make install
cd .. /libpng-1.2.18
./configure --prefix=/usr ; make ; make install
cd ..
然后开始安装RRDTOOL
tar -zxvf rrdtool-1.2.27.tar.gz
cd rrdtool-1.2.27/src
修改里面rrd_gfx..c 和rrd_graph.c

修改rrd_graph.c:
请删除rrd_graph.c文件 3065和3067行
3065: setlocale(LC_TIME,"");
3067: setlocale(LC_CTYPE,"");
在原3067行增加以下内容:
    setlocale(LC_ALL,"zh_CN.UTF-8");

修改rrd_gfx.c:
1).请在519行增加:
  free(w_text);
2)请修改446行为:
    glyph->index = FT_Get_Char_Index( face, w_text[n]);
3)请417行处增加:
  w_text = (wchar_t) calloc (string->count,sizeof(wchar_t));
  mbstowcs(w_text,text,string->count);
4)请在387行处增加
  wchar_t* w_text;

然后,
Cd ..
./configure --prefix=/usr --exec-prefix=/usr/rrd1.2.27 ; make ; make install

OK!

现在其它的都已经OK只差Cacti  去wysilly兄的Blog下载Cacti的中文版
[url]http://blog.chinaunix.net/u/4312/showart_478158.html[/url]

然后把文件解压到 /var/www 里面 在Apache里设置主目录即可。

文件夹里有个cacti.sql 这个是数据库文件

Useradd cactiuser
Passwd cactiuser

chown -R cactiuser rra/ log/  #要cd /var/www/html 进入文件夹

Mysql –uroot –p
Password:

Mysql>create database cacti;
Mysql>exit;

Mysql –uroot –p cacti< /var/www/html/cacti.sql  #这是我的目录
Password:

Mysql –uroot –p
Password:
mysql>grant all privileges on cacti.* to cactiuser@localhost identified by 'cactiuser';
mysql>flush privileges;

新增自动执行到 /etc/crontab 文档里:
shell>crontab -u cactiuser -e
*/5 * * * * cactiuser php /var/www/html/poller.php > /dev/null 2>&1


OK!
最后再装一下Spine
[url]http://148.6.0.24/linux/debian/pool/main/c/cacti-spine/cacti-spine_0.8.7a-2_i386.deb[/url]
sudo dpkg -i cacti-spine_0.8.7a-2_i386.deb



再贴上几张图:












發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章