所需要的软件包:
apache
mysql(可以使用系统自带版本)
net-snmp
rrdtool
php
zlib
libpng
freetype
jpeg
fontconfig
libart_lgpl
gd
cacti
cactid
以上为老版本方法所需要的包,新版本使用了spine方式,不需要cactid啦,可能有一些包我没有写,大家向下看吧,我也是参照网上一些例子装,碰到了好多问题,解决办法我都写到了这里啦。。
一、apache的安装
tar zxvf httpd*.tar.gz
./configure --prefix=/usr/local/apache --enable-so
make
make install
二、安装PHP
先安装zlib,freetype,libpng,jpeg,gd
1.安装zlib(也可以使用系统自带的)
./configure --prefix=/usr/local/zlib
make
make install
2.安装libpng(也可以使用系统自带的)
cd scripts/
mv makefile.linux ../makefile
cd ..
make
make install
3.安装freetype
./configure --prefix=/usr/local/freetype
make
make install
4.安装jpeg(可以使用系统自带的)
cd jpeg-6b/
mkdir /usr/local/libjpeg
mkdir /usr/local/libjpeg/include
mkdir /usr/local/libjpeg/bin
mkdir /usr/local/libjpeg/lib
mkdir /usr/local/libjpeg/man
mkdir /usr/local/libjpeg/man/man1
./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
make
make install
5.安装fontconfig
./configure
make
make install
6.安装GD
./configure --prefix=/usr/local --with-jpeg --with-png --with-zlib --with-freetype
make
make install
7.安装php
./configure --prefix=/usr/local --with-config-file-path=/usr/local/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql --with-gd --enable-gd-native-ttf --with-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --enable-xml --enable-mbstring --enable-magic-quotes --with-iconv --enable-force-cgi-redirect --enable-socket
make
make install
如果在进行make install安装时提示没有找到libphp5.so的话,请查看你的php编译libtool和apache的libtool是不是同一个版本,如果不是,请把apache的拷贝到你的编译包里,执行make clean && make install
cp php.ini-dist /usr/local/php/lib/php.ini
ln -s /usr/local/php/bin/* /usr/local/bin/
vi /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
修改DirectoryIndex 行,添加index.php
修改为DirectoryIndex index.php index.html index.html.var
三、安装RRDTOOL
安装RRDTOOL时,最好看一下rrdtool里的doc下的rrdbuild.txt文件都是安排那些依赖包,在这里我是按照这个文档安装的,不然有很多问题不知道如何处理。
1.安装cgilib
对于0.5版本的cgilib源码部分需做一定的修改:
在 cgi.c 里寻找 #include ,把那行删掉或注释掉
修改cgitest.c中116行的错误
116行的代码如下:
printf ("Cookie "Library" set
\n");
应为代码出错,正确的应是
printf ("Cookie \"Library\" set
\n");
make
make install
2.安装libart_lgpl
./configure --disable-shared --prefix=/usr
make
make install
3.安装pango
./configure
make
make install
4.安装pixman
./configure
make
make install
cp /usr/local/lib/pkgconfig/pixman-1.pc /usr/lib/pkgconfig/
5.安装cairo
export CFLAGS="-O3 -fPIC"
export LDFLAGS="-Wl,--rpath -Wl,/usr/local/lib"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure
make
make install
6.安装pango
./configure --enable-pangcairo
make
make install
7.安装rrdtool
./configure --prefix=/usr/local/rrdtool --disable-python --disable-tcl
make
make install
//完成后建立符号连接
ln –s /usr/local/rrdtool/bin/* /usr/local/bin/
//执行rrdtool看是否安装正确
四、安装net-snmp
前提一定要把beecrypt安装上,devel也要安装上,也可以使用系统自带的net-snmp
./configure --prefix=/usr/local/net-snmp --enable-developer
make(报错,/usr/bin/ld:cannot find -lelf;解决办法:ln -s libelf.so.1 /usr/lib/libelf.so ; echo /usr/local/lib >/etc/ld.so.conf.d/libnetsnmp.conf ; /sbin/ldconfig -v ;)
make install
ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf
cd /usr/local/net-snmp/sbin/
./snmpd
放到/etc/rc.d/rc.local里让系统自启动
#vi /etc/snmp/snmpd.conf
更改:
com2sec notConfigUser default public
改为:com2sec notConfigUser 192.168.0.10 public
2、access notConfigGroup "" any noauth exact systemview none none
改为:access notConfigGroup "" any noauth exact all none none
3、#view all included .1 80
将前面的 # 注释 去掉。
五、安装cacti
1、# mv –r cacti-0.8.6j /usr/loca/apache/htdocs/cacti
# vi /usr/local/apache/htdocs/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
2、//添加cacti用户
# useradd cacti
//将rra目录的所有权给cacti用户
# chown –R cacti /usr/loca/apache/htdocs/cacti/rra
//修改cacti目录所属组
# chgrp –R cacti /usr/loca/apache/htdocs/cacti
//为cacti用户添加cron任务
# su – cacti
# crontab –e
*/5 * * * * /usr/local/bin/php /usr/local/apache/htdocs/cacti/poller.php > /dev/null 2>&1
3、cactid的安装
./configure --with-mysql --with-snmp=/usr/local/net-snmp
make
//这时你将在此目录下看到多出了cactid、cactid.conf两个文件
# mkdir /usr/local/cactid
# cp cactid cactid.conf /usr/local/cactid
# vi /usr/local/cactid/cactid.conf //修改cactid配置文件
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass cacti
六、配置mysql
#mysql -uroot -p
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on cacti.* to root;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on cacti.* to root;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on cacti.* to root@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on cacti.* to cacti;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on cacti.* to cacti@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for cacti@localhost=password('XXX');
Query OK, 0 rows affected (0.00 sec)
mysql> exit
# cd /usr/local/apache2/htdocs/cacti
#mysql –u root –pXXX cacti < /usr/local/apache/htdocs/cacti/cacti.sql
阅读(1009) | 评论(0) | 转发(0) |