linux下面源码安装mrtg与关联的软件

ncurses的安装
[root@localhost ~]# tar zxvf /mnt/ncurses-5.7.tar.gz -C /tmp
[root@localhost ~]# cd /tmp/ncurses-5.7/
[root@localhost ncurses-5.7]# ./configure --prefix=/www/ncurses --with-shared
** Configuration summary for NCURSES 5.7 20081102:

     extended funcs: yes
     xterm terminfo: xterm-new

      bin directory: /www/ncurses/bin
      lib directory: /www/ncurses/lib
  include directory: /www/ncurses/include/ncurses
      man directory: /www/ncurses/man
 terminfo directory: /www/ncurses/share/terminfo

** Include-directory is not in a standard location
[root@localhost ncurses-5.7]# make
[root@localhost ncurses-5.7]# make install

httpd的安装
[root@localhost ncurses-5.7]# tar zxvf /mnt/httpd-2.2.9.tar.gz -C /tmp
[root@localhost ncurses-5.7]# cd ../httpd-2.2.9/
[root@localhost httpd-2.2.9]# ./configure --prefix=/www/httpd --enable-modules=all --enable-so --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-

cache --enable-proxy --enable-proxy-http --enable-proxy-ftp --enable-proxy-ajp --enable-proxy-balancer --with-mpm=worker --enable-mods-shared=all --enable-static-ab

--enable-cgi --enable-rewrite
make[4]: Leaving directory `/tmp/httpd-2.2.9/modules/mappers'
make[3]: Leaving directory `/tmp/httpd-2.2.9/modules/mappers'
make[2]: Leaving directory `/tmp/httpd-2.2.9/modules'
make[2]: Entering directory `/tmp/httpd-2.2.9/support'
make[2]: Leaving directory `/tmp/httpd-2.2.9/support'
make[1]: Leaving directory `/tmp/httpd-2.2.9'
[root@localhost httpd-2.2.9]# make
[root@localhost httpd-2.2.9]# make install
[root@localhost httpd-2.2.9]# /www/httpd/bin/apachectl start
[root@localhost httpd-2.2.9]# ps axu|grep httpd
root     14711  1.2  1.0   5280  2580 ?        Ss   18:06   0:00 /www/httpd/bin/httpd -k start
daemon   14712  0.3  0.6   5168  1744 ?        S    18:06   0:00 /www/httpd/bin/httpd -k start
daemon   14713  1.0  0.8 281916  2228 ?        Sl   18:06   0:00 /www/httpd/bin/httpd -k start
daemon   14715  0.6  0.8 281916  2228 ?        Sl   18:06   0:00 /www/httpd/bin/httpd -k start
daemon   14717  1.0  0.8 281916  2232 ?        Sl   18:06   0:00 /www/httpd/bin/httpd -k start
root     14798  0.0  0.2   3908   696 pts/0    S+   18:06   0:00 grep httpd
[root@localhost httpd-2.2.9]# netstat -tuln|grep 80
tcp        0      0 :::80                       :::*                        LISTEN

zlib的安装
[root@localhost httpd-2.2.9]# tar zxvf /mnt/zlib-1.2.3.tar.gz -C /tmp
[root@localhost httpd-2.2.9]# cd ../zlib-1.2.3/
[root@localhost zlib-1.2.3]# ./configure --prefix=/www/zlib
[root@localhost zlib-1.2.3]# make 
[root@localhost zlib-1.2.3]# make install

libpng的安装
[root@localhost zlib-1.2.3]# tar zxvf /mnt/libpng-1.2.40.tar.gz -C /tmp
[root@localhost zlib-1.2.3]# cd ../libpng-1.2.40/
[root@localhost libpng-1.2.40]# ./configure --prefix=/www/libpng
[root@localhost libpng-1.2.40]# make
[root@localhost libpng-1.2.40]# make install

freetype的安装
[root@localhost libpng-1.2.40]# tar zxvf /mnt/freetype-2.3.5.tar.gz -C /tmp
[root@localhost libpng-1.2.40]# cd ../freetype-2.3.5/
[root@localhost freetype-2.3.5]# ./configure --prefix=/www/freetype
[root@localhost freetype-2.3.5]# make
[root@localhost freetype-2.3.5]# make install

jpegsrc的安装
[root@localhost freetype-2.3.5]# tar zxvf /mnt/jpegsrc.v6b.tar.gz -C /tmp
[root@localhost freetype-2.3.5]# cd ../jpeg-6b/
安装的时候我们出现了下面从错误。
[root@server jpeg-6b]# make install
/usr/bin/install -c cjpeg /soft/www/jpegsrc/bin/cjpeg
/usr/bin/install: cannot create regular file `/soft/www/jpegsrc/bin/cjpeg': No such file or directory
make: *** [install] Error 1
/usr/bin/install: cannot create regular file `/soft/www/jpegsrc/man/man1/cjpeg.1': No such file or directory可以了阿
我们新建下面这两个文件就可以了阿。
[root@localhost jpeg-6b]# mkdir /www/jpegsrc/man/man1/cjpeg.1 -p
[root@localhost jpeg-6b]# mkdir /www/jpegsrc/bin/cjpeg -p
[root@localhost jpeg-6b]# make 
[root@localhost jpeg-6b]# make install
[root@localhost jpeg-6b]# tar zxvf /mnt/gd-2.0.35.tar.gz -C /tmp
[root@localhost jpeg-6b]# cd ../gd-2.0.35/
configure.ac:64: error: possibly undefined macro: AM_ICONV
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
make: *** [configure] Error 1
出现这个原因是因为我们没有安装gettext这个包的原因,但是这个包其实是已经安装过的,我们强制安装一次。
[root@localhost gd-2.0.35]# rpm -vih /iso/Server/gettext-0.14.6-4.el5.i386.rpm  --force
warning: /iso/Server/gettext-0.14.6-4.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:gettext                ########################################### [100%]
[root@localhost gd-2.0.35]# ./configure --prefix=/www/gd --with-png=/www/libpng --with-freetype=/www/freetype --with-jpeg=/www/jpegsrc
** Configuration summary for gd 2.0.34:

   Support for PNG library:          yes
   Support for JPEG library:         yes
   Support for Freetype 2.x library: yes
   Support for Fontconfig library:   yes
   Support for Xpm library:          yes
   Support for pthreads:             yes
[root@localhost gd-2.0.35]# make
[root@localhost gd-2.0.35]# make install
[root@localhost gd-2.0.35]# tar zxvf /mnt/libxml2-2.7.3.tar.gz -C /tmp
[root@localhost gd-2.0.35]# cd ../libxml2-2.7.3/
[root@localhost libxml2-2.7.3]# ./configure --prefix=/www/libxml
[root@localhost libxml2-2.7.3]# make 
[root@localhost libxml2-2.7.3]# make install


mrtg的安装
[root@localhost libxml2-2.7.3]# tar zxvf /mnt/mrtg.tar.gz -C /tmp
[root@localhost libxml2-2.7.3]# cd ../mrtg-2.16.4/
[root@localhost mrtg-2.16.4]# ./configure --prefix=/www/mrtg --with-gd=/www/gd --with-gd-lib=/www/gd/lib --with-gd-inc=/www/gd/include -with-

png=/www/libpng --with-png-lib=/www/libpng/lib --with-z=/www/zlib --with-z-lib=/www/zlig/lib
[root@localhost mrtg-2.16.4]# make 
[root@localhost mrtg-2.16.4]# make install

snmp的安装
[root@localhost mrtg-2.16.4]# rpm -vih /iso/Server/lm_sensors-devel-2.10.7-4.el5.i386.rpm 
[root@localhost mrtg-2.16.4]# rpm -vih /iso/Server/net-snmp-5.3.2.2-5.el5.i386.rpm 
[root@localhost ~]# rpm -vih /iso/Server/net-snmp-utils-5.3.2.2-5.el5.i386.rpm

[root@localhost mrtg-2.16.4]# vi /etc/snmp/snmpd.conf 
access  notConfigGroup ""      any       noauth    exact  systemview none none这个这行改成下面这样
access  notConfigGroup ""      any       noauth    exact all all none
#view all    included  .1                               80
#view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc
改成下面这样。
view all    included  .1                               80
view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc
[root@localhost mrtg-2.16.4]# /etc/init.d/snmpd restart
Stopping snmpd: [FAILED]
Starting snmpd: [  OK  ]
[root@localhost ~]# snmpwalk -v 1 -c public 192.168.11.11 IP-MIB::ipAdEntIfIndex  
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.1.153 = INTEGER: 3
IP-MIB::ipAdEntIfIndex.192.168.11.11 = INTEGER: 2

[root@localhost ~]# netstat -tuln|grep 161
udp        0      0 0.0.0.0:161                 0.0.0.0:*

说明SNMP成功的,并且能获得192.168.11.11的mib信息。

[root@localhost ~]# mkdir /www/httpd/htdocs/mrtg  这个是用与存放mrtg的网页
[root@localhost bin]# mkdir  /www/mrtg/etc  这个是用于存放mrtg的配置文件。
下面是生成配置文件。
[root@localhost bin]# ./cfgmaker --global "WorkDir:/www/httpd/htdocs/mrtg" -global "Options[_]:growright,bits" -ifref=ip --output /www/mrtg/etc/mrtg.cfg

public@192.168ncurses的安装
[root@localhost ~]# tar zxvf /mnt/ncurses-5.7.tar.gz -C /tmp
[root@localhost ~]# cd /tmp/ncurses-5.7/
[root@localhost ncurses-5.7]# ./configure --prefix=/www/ncurses --with-shared
** Configuration summary for NCURSES 5.7 20081102:

extended funcs: yes
xterm terminfo: xterm-new

bin directory: /www/ncurses/bin
lib directory: /www/ncurses/lib
include directory: /www/ncurses/include/ncurses
man directory: /www/ncurses/man
terminfo directory: /www/ncurses/share/terminfo

** Include-directory is not in a standard location
[root@localhost ncurses-5.7]# make
[root@localhost ncurses-5.7]# make install

httpd的安装
[root@localhost ncurses-5.7]# tar zxvf /mnt/httpd-2.2.9.tar.gz -C /tmp
[root@localhost ncurses-5.7]# cd ../httpd-2.2.9/
[root@localhost httpd-2.2.9]# ./configure --prefix=/www/httpd --enable-modules=all --enable-so --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-
cache --enable-proxy --enable-proxy-http --enable-proxy-ftp --enable-proxy-ajp --enable-proxy-balancer --with-mpm=worker --enable-mods-shared=all --enable-static-ab 
--enable-cgi --enable-rewrite
make[4]: Leaving directory `/tmp/httpd-2.2.9/modules/mappers'
make[3]: Leaving directory `/tmp/httpd-2.2.9/modules/mappers'
make[2]: Leaving directory `/tmp/httpd-2.2.9/modules'
make[2]: Entering directory `/tmp/httpd-2.2.9/support'
make[2]: Leaving directory `/tmp/httpd-2.2.9/support'
make[1]: Leaving directory `/tmp/httpd-2.2.9'
[root@localhost httpd-2.2.9]# make
[root@localhost httpd-2.2.9]# make install
[root@localhost httpd-2.2.9]# /www/httpd/bin/apachectl start
[root@localhost httpd-2.2.9]# ps axu|grep httpd
root 14711 1.2 1.0 5280 2580 ? Ss 18:06 0:00 /www/httpd/bin/httpd -k start
daemon 14712 0.3 0.6 5168 1744 ? S 18:06 0:00 /www/httpd/bin/httpd -k start
daemon 14713 1.0 0.8 281916 2228 ? Sl 18:06 0:00 /www/httpd/bin/httpd -k start
daemon 14715 0.6 0.8 281916 2228 ? Sl 18:06 0:00 /www/httpd/bin/httpd -k start
daemon 14717 1.0 0.8 281916 2232 ? Sl 18:06 0:00 /www/httpd/bin/httpd -k start
root 14798 0.0 0.2 3908 696 pts/0 S+ 18:06 0:00 grep httpd
[root@localhost httpd-2.2.9]# netstat -tuln|grep 80
tcp 0 0 :::80 :::* LISTEN

zlib的安装
[root@localhost httpd-2.2.9]# tar zxvf /mnt/zlib-1.2.3.tar.gz -C /tmp
[root@localhost httpd-2.2.9]# cd ../zlib-1.2.3/
[root@localhost zlib-1.2.3]# ./configure --prefix=/www/zlib
[root@localhost zlib-1.2.3]# make 
[root@localhost zlib-1.2.3]# make install

libpng的安装
[root@localhost zlib-1.2.3]# tar zxvf /mnt/libpng-1.2.40.tar.gz -C /tmp
[root@localhost zlib-1.2.3]# cd ../libpng-1.2.40/
[root@localhost libpng-1.2.40]# ./configure --prefix=/www/libpng
[root@localhost libpng-1.2.40]# make
[root@localhost libpng-1.2.40]# make install

freetype的安装
[root@localhost libpng-1.2.40]# tar zxvf /mnt/freetype-2.3.5.tar.gz -C /tmp
[root@localhost libpng-1.2.40]# cd ../freetype-2.3.5/
[root@localhost freetype-2.3.5]# ./configure --prefix=/www/freetype
[root@localhost freetype-2.3.5]# make
[root@localhost freetype-2.3.5]# make install

jpegsrc的安装
[root@localhost freetype-2.3.5]# tar zxvf /mnt/jpegsrc.v6b.tar.gz -C /tmp
[root@localhost freetype-2.3.5]# cd ../jpeg-6b/
安装的时候我们出现了下面从错误。
[root@server jpeg-6b]# make install
/usr/bin/install -c cjpeg /soft/www/jpegsrc/bin/cjpeg
/usr/bin/install: cannot create regular file `/soft/www/jpegsrc/bin/cjpeg': No such file or directory
make: *** [install] Error 1
/usr/bin/install: cannot create regular file `/soft/www/jpegsrc/man/man1/cjpeg.1': No such file or directory可以了阿
我们新建下面这两个文件就可以了阿。
[root@localhost jpeg-6b]# mkdir /www/jpegsrc/man/man1/cjpeg.1 -p
[root@localhost jpeg-6b]# mkdir /www/jpegsrc/bin/cjpeg -p
[root@localhost jpeg-6b]# make 
[root@localhost jpeg-6b]# make install
[root@localhost jpeg-6b]# tar zxvf /mnt/gd-2.0.35.tar.gz -C /tmp
[root@localhost jpeg-6b]# cd ../gd-2.0.35/
configure.ac:64: error: possibly undefined macro: AM_ICONV
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
make: *** [configure] Error 1
出现这个原因是因为我们没有安装gettext这个包的原因,但是这个包其实是已经安装过的,我们强制安装一次。
[root@localhost gd-2.0.35]# rpm -vih /iso/Server/gettext-0.14.6-4.el5.i386.rpm --force
warning: /iso/Server/gettext-0.14.6-4.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:gettext ########################################### [100%]
[root@localhost gd-2.0.35]# ./configure --prefix=/www/gd --with-png=/www/libpng --with-freetype=/www/freetype --with-jpeg=/www/jpegsrc
** Configuration summary for gd 2.0.34:

Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Fontconfig library: yes
Support for Xpm library: yes
Support for pthreads: yes
[root@localhost gd-2.0.35]# make
[root@localhost gd-2.0.35]# make install
[root@localhost gd-2.0.35]# tar zxvf /mnt/libxml2-2.7.3.tar.gz -C /tmp
[root@localhost gd-2.0.35]# cd ../libxml2-2.7.3/
[root@localhost libxml2-2.7.3]# ./configure --prefix=/www/libxml
[root@localhost libxml2-2.7.3]# make 
[root@localhost libxml2-2.7.3]# make install


mrtg的安装
[root@localhost libxml2-2.7.3]# tar zxvf /mnt/mrtg.tar.gz -C /tmp
[root@localhost libxml2-2.7.3]# cd ../mrtg-2.16.4/
[root@localhost mrtg-2.16.4]# ./configure --prefix=/www/mrtg --with-gd=/www/gd --with-gd-lib=/www/gd/lib --with-gd-inc=/www/gd/include -with-
png=/www/libpng --with-png-lib=/www/libpng/lib --with-z=/www/zlib --with-z-lib=/www/zlig/lib
[root@localhost mrtg-2.16.4]# make 
[root@localhost mrtg-2.16.4]# make install

snmp的安装
[root@localhost mrtg-2.16.4]# rpm -vih /iso/Server/lm_sensors-devel-2.10.7-4.el5.i386.rpm 
[root@localhost mrtg-2.16.4]# rpm -vih /iso/Server/net-snmp-5.3.2.2-5.el5.i386.rpm 
[root@localhost ~]# rpm -vih /iso/Server/net-snmp-utils-5.3.2.2-5.el5.i386.rpm

[root@localhost mrtg-2.16.4]# vi /etc/snmp/snmpd.conf 
access notConfigGroup "" any noauth exact systemview none none这个这行改成下面这样
access notConfigGroup "" any noauth exact all all none
#view all included .1 80
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
改成下面这样。
view all included .1 80
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
[root@localhost mrtg-2.16.4]# /etc/init.d/snmpd restart
Stopping snmpd: [FAILED]
Starting snmpd: [ OK ]
[root@localhost ~]# snmpwalk -v 1 -c public 192.168.11.11 IP-MIB::ipAdEntIfIndex 
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.1.153 = INTEGER: 3
IP-MIB::ipAdEntIfIndex.192.168.11.11 = INTEGER: 2

[root@localhost ~]# netstat -tuln|grep 161
udp 0 0 0.0.0.0:161 0.0.0.0:*

说明SNMP成功的,并且能获得192.168.11.11的mib信息。

[root@localhost ~]# mkdir /www/httpd/htdocs/mrtg 这个是用与存放mrtg的网页
[root@localhost bin]# mkdir /www/mrtg/etc 这个是用于存放mrtg的配置文件。
下面是生成配置文件。
[root@localhost bin]# ./cfgmaker --global "WorkDir:/www/httpd/htdocs/mrtg" -global "Options[_]:growright,bits" -ifref=ip --output /www/mrtg/etc/mrtg.cfg 
public@192.168.11.12 public@192.168.11.11

[root@localhost bin]# vi /www/mrtg/etc/mrtg.cfg 
EnableIPv6: no
WorkDir:/www/httpd/htdocs/mrtg
Language:Chinese 添加这个支持中文。
Options[_]:growright,bits
[root@localhost bin]# env LANG=C /www/mrtg/bin/mrtg /www/mrtg/etc/mrtg.cfg 运行第三次的时候就不会报错误了。
[root@localhost bin]# ./indexmaker /www/mrtg/etc/mrtg.cfg --output /www/httpd/htdocs/mrtg/index.html
[root@localhost bin]# tail -1 !$
tail -1 /etc/crontab
*/5 * * * * env LANG=C /www/mrtg/bin/mrtg /www/mrtg/etc/mrtg.cfg
[root@localhost bin]# /etc/init.d/crond start
Starting crond: [ OK ]
[root@localhost bin]# /www/httpd/bin/apachectl restart
http://192.168.11.12/mrtg/
已经得到了想要的结果。.11.12 public@192.168.11.11

[root@localhost bin]# vi /www/mrtg/etc/mrtg.cfg 
EnableIPv6: no
WorkDir:/www/httpd/htdocs/mrtg
Language:Chinese 添加这个支持中文。
Options[_]:growright,bits
[root@localhost bin]# env LANG=C /www/mrtg/bin/mrtg /www/mrtg/etc/mrtg.cfg 运行第三次的时候就不会报错误了。
[root@localhost bin]# ./indexmaker /www/mrtg/etc/mrtg.cfg --output /www/httpd/htdocs/mrtg/index.html
[root@localhost bin]# crontab -e

加上下面这行
*/5 * * * * env LANG=C /www/mrtg/bin/mrtg /www/mrtg/etc/mrtg.cfg
[root@localhost bin]# /etc/init.d/crond start
Starting crond: [  OK  ]
[root@localhost bin]# /www/httpd/bin/apachectl restart
http://192.168.11.12/mrtg/
已经得到了想要的结果。




  本文转自7343696 51CTO博客,原文链接:http://blog.51cto.com/luoping/340758,如需转载请自行联系原作者



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值