cd /usr/local/src
wget http://www.zlib.net/zlib-1.2.3.tar.gz
gunzip -c zlib-*.tar.gz | tar xf -
rm zlib-*.tar.gz
mv zlib-* zlib
cd zlib
./configure
make
make install
cd ..wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.40.tar.gz
gunzip -c libpng-1.2.34.tar.gz | tar xf -
mv libpng-* libpng
cd libpng
env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
make
make install
cd ..
下边的步骤gd文件分两个版本,低版本系统就用1.8.4(redhat5.0以下版本),如果不好用就用2.0.33版本的。推荐直接用2.0.33版本。
gd1.8.4 安装步骤:
gunzip -c gd-*.tar.gz |tar xf -
rm gd-*.tar.gz
mv gd-* gd
cd gd
make INCLUDEDIRS="-I. -I../zlib -I../libpng" \
LIBDIRS="-L../zlib -L. -L../libpng" \
LIBS="-lgd -lpng -lz -lm" \
CFLAGS="-O -DHAVE_LIBPNG"
cd ..
gd2.0.33 安装:
gunzip -c gd-2.0.33.tar.gz |tar xf -
mv gd-2.0.33 gd
cd gd
env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" \
./configure --disable-shared --without-freetype --without-jpeg
make
make install
安装mrtg:
cd /usr/local/src
gunzip -c mrtg-2.17.4.tar.gz | tar xvf -
cd mrtg-2.17.4
( ./configure --prefix=/usr/local/mrtg-2)
--with-gd=/usr/local/src/gd \
--with-z=/usr/local/src/zlib \
--with-png=/usr/local/src/libpng
cd /usr/local/src
tar zxvf httpd-2.2.9.tar.gz
cd httpd-2.2.9/
make install
配置生成MRTG配置文件脚本。
vi mkcfg
--global 'Refresh: 300' \
--global 'Interval: 5' \
--global 'Options[_]: bits,growright' \
--no-down \
--OUTPUT /usr/local/mrtg-2/etc/mrtg.cfg \ (这里当每扫描一个ip段就会重新生成,可以命别的名字例如:mrtg.cfg192.168.1.1 )
'htidc(’@192.168.1.1
vi mkindex.html
编辑生成网页文件的脚本
vi mkindex.html
./mkindex.html
网页文件就生成了,然后把文件复制到 目的目录,
*/5 * * * * /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/mrtg.cfg --logging /usr/local/mrtg-2/etc/mrtg.log &
最后启动mrtg
env LANG=C /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/etc/mrtg.cfg
最后可以浏览网页了。
( 注意 :每个程序都要 make 后 再make install 。程序里边的cfgmaker可能有问题,)
cfgmaker 下载地址:http://down.51cto.com/data/690942