hmslucky 2012-12-11
1 安装web服务器
a yum 源
CentOS6-Base-163.repo
rpm -ivh epel-release-6-7.noarch.rpm
b 安装支持环境
yum install httpd
yum install httpd-devel
yum install gcc make
yum install perl-devel perl-Time-HiRes
yum install rrdtool-perl
2 安装rrdtool
a rrdtool依赖的库
yum install libxml2-devel libpng-devel
yum install pango pango-devel
yum install libart_lgpl libart_lgpl-devel
yum install freetype freetype-devel fontconfig cairo cairo-devel
b 安装 rrdtool
tar -zxvf rrdtool-1.4.5.tar.gz
cd rrdtool-1.4.5
./configure --prefix=/usr/local/rrdtool --disable-tcl --disable-python
make && make install
3 安装fping
a 安装cgilib
tar zxvf cgilib-0.5.tar.gz
cd cgilib-0.5
make
cp libcgi.a /usr/local/lib
cp cgi.h /usr/include/
b 安装fping
tar zxvf fping.tar.gz
cd fping-2.4b2_to/
./configure
make && make install
4 安装echoping
a 安装gettext
tar xzvf gettext-0.18.tar.gz
cd gettext-0.18
./configure
make && make install
b 安装popt
tar zxvf popt-1.7.tar.gz
cd popt-1.7
./configure
make && make install
c 安装echoping
tar zxvf echoping-6.0.0.tar.gz
cd echoping-6.0.0
./configure --without-libidn
make && make install
4 安装FCGI
tar zxvf FCGI-0.74.tar.gz
cd FCGI-0.74
perl Makefile.PL
make && make install
5 安装mod_fastcgi
tar zxvf mod_fastcgi-2.4.6.tar.gz
cd mod_fastcgi-2.4.6
/usr/sbin/apxs -o mod_fastcgi.so -c *.c
/usr/sbin/apxs -i -a -n fastcgi .libs/mod_fastcgi.so
确定 /etc/httpd/conf/httpd.conf 有
LoadModule fastcgi_module modules/mod_fastcgi.so
6 安装smokeping
tar zxvf smokeping-2.6.8.tar.gz
cd smokeping-2.6.8
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install
修改配置文件
cd /usr/local/smokeping/bin/
vim smokeping
第五行:use lib qw(); # PERL5LIB
修改为:use lib qw(/usr/local/rrdtool/lib/perl); # PERL5LIB
cd ../htdocs/
mv smokeping.fcgi.dist smokeping.fcgi
cd ../etc/
cp config.dist config
修改配置文件
vim config
10 imgcache = /var/www/html/smokeping/img
11 imgurl = http://192.168.1.230/smokeping/img
14 cgiurl = http://192.168.1.230/smokeping/smokeping.cgi
108 binary = /usr/local/sbin/fping
7 配置HTTP运行环境
a 创建目录
mkdir -p /var/www/html/smokeping/img /var/www/html/smokeping/script/ /usr/local/smokeping/data /usr/local/smokeping/var
b 建立软链接,把smokping目录下的文件软链接到HTTP目录下
ln -s /usr/local/smokeping/htdocs/cropper /var/www/html/smokeping/cropper
ln -s /usr/local/smokeping/htdocs/smokeping.fcgi /var/www/html/smokeping/smokeping.fcgi
c 分配权限
chown -R apache:apache /var/www/html/smokeping/
d 修改HTTP 配置文件
vim /etc/httpd/conf/httpd.conf
添加
277 ServerName localhost:80
332 ptions Indexes FollowSymLinks ExecCGI
403 DirectoryIndex index.html index.html.var /smokeping/smokeping.fcgi
797 AddHandler cgi-script .fcgi
e 启动httpd
service httpd start
8 启动smokeping
chmod 400 /usr/local/smokeping/etc/smokeping_secrets.dist
nohup /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &