Welcome 微信登录

首页 / 操作系统 / Linux / CentOS 5.5安装ntop

我使用的Linux系统是CentOS 5.5,有些系统服务版本比较低或者没有,需要手动去安装,例如实验ntop依赖Python2.6以上的版本,但系统自带的版本则是2.4。CentOS yum 升级Python2.6 到 2.7 http://www.linuxidc.com/Linux/2014-07/104555.htm在Red Hat Enterprise Linux 5.3安装NTOP  http://www.linuxidc.com/Linux/2011-07/38130.htm  使用yum快速安装ntop的依赖包:$ yum install libpcap libpcap-devel libtool linpng gdbm libxml2-devel gdbm-devel  svn  pango-devel pango subversion GeoIP GeoIP-devel如果不安装svn和subversion,在编译的安装的时候回报以下的错误:You must have svn/subversion installed to compile autogen.sh.Download the appropriate package for your distribution, or get thesource from http://subversion.tigris.org$ tar zxf ntop-5.0.1.tar.gz$ cd ntop-5.0.1$ ./autogen.sh --with-tcpwrap第一个错误:configure: error: Unable to find RRD at /usr/local: please use --with-rrd-home=DIR解决方法:$wget http://down1.chinaunix.net/distfiles/rrdtool-1.3.5.tar.gz$tar zxf rrdtool-1.3.5.tar.gz$cd rrdtool-1.3.5$./confogure --prefix=/usr/local/rrdtool$make && make install$ ./autogen.sh --prefix=/usr/local/ntop  --with-tcpwrap --with-rrd-home=/usr/share/rrdtool/ 
第二个错误:checking for python-config... no>>>> Unable to locate python-config: using workaround <<<<checking for python... pythonchecking Checking python version... Old python installed 
Please install python 2.6 or newer.解决方法: 
#wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz#tar zxvf Python-2.7.3.tgz#cd Python-2.7.3$ cd Python-2.7.3$ ./configure --prefix=/usr/local/python27$mv /usr/bin/python /usr/bin/python.old$ ln -s /usr/local/python27/bin/python /usr/bin/$ pythonPython 2.7.3 (default, Oct  9 2014, 15:06:43)[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>>  ( ctrl+d )=退出安装完以后会发现yum不能使用,因为yum需要依赖于/usr/bin/python运行,所以,要做一下修改。$vi /usr/bin/yum 把#!/usr/bin/python改为#!/usr/bin/python.old 
第三个错误:Removing dups and misplaced entries from LIBS and INCS...checking for GeoIP_record_by_ipnum in -lGeoIP... nochecking for GeoIP_name_by_ipnum_v6 in -lGeoIP... noPlease install GeoIP (http://www.maxmind.com/)解决方法: 明明我在开始的时候就已经通过yum方式安装了GeoIP GeoIP-devel,为什么还报这样的错呢?在这里纠结的好久,最后在网上找到的解决方法。$ wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz$ tar zxf GeoIP.tar.gz$ cd GeoIP-1.4.8/$ ./configure && make && make install$wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz$tar zxf GeoIP.tar.gz$cd GeoIP-1.3.2$ python setup.py build$ python setup.py install最后就应该可以编译安装了。
[root@localhost rrdtool-1.3.5]# ./autogen.sh --prefix=/usr/local/ntop  --with-tcpwrap --with-rrd-home=/usr/share/rrdtool/[root@localhost rrdtool-1.3.5]#  make $$ make install$ groupadd ntop$useradd -M -s /sbin/nologin -g ntop ntop$ chown -R ntop.ntop /usr/local/ntop/share/ntop$ chown -R ntop.ntop /usr/local/ntop/var/ntop/$ chown -R ntop.ntop /usr/local/ntop/lib/配置ntop的管理员密码:$ntop -A授权外部iP地址通过tcp-wrappers$echo "ntop 192.168.1.114" >> /etc/hosts.allow拒绝外部ip地址:$echo "ntop:ALL" >> /etc/hosts.deny启动ntop:$ cd /usr/local/ntop/bin$./ntop通过浏览器访问:http://ip:3000更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14本文永久更新链接地址