源码方式ntop安装记录(debian/ubuntu)

http://www.netren.org/index.php/component/content/article/37-guo/146-ntop-debian-ubuntu.html

ntop是一款优秀的网络流量监控软件,它可以用图视形式只管的展现网络环境及各项参数。要安装使用它,对于初学者来说是件不易的事情,因为它需要太多辅助软件包的依赖。不过也还好,摸着石头总能过河。今天,我们就在Linux ubuntu10.04的环境下进行此软件的安装。

首先下载此软件(约37M)

http://cdnetworks-kr-1.dl.sourceforge.net/project/ntop/ntop/ntop-4.0.1/ntop-4.0.1.tar.gz


我将其tar.gz原安装包放置在/var/www/下,并运行

tar zvxf ntop-4.0.1.tar.gz 进行解压缩

cd ntop-4.0.1

和以往的源码编译不同,ntop目录下未包含configure脚本文件,注意autogen.sh的文件我们可以运行看看。

首先运行autogen.sh脚本文件。
root@netren:/var/www/ntop-4.0.1# bash autogen.sh

Starting ntop automatic configuration system v.0.2.3

Please be patient, there is a lot to do...

1. Testing gnu tools....

You must have libtool installed to compile ntop.

Download the appropriate package for your distribution, or get the
source tarball from
ftp://ftp.gnu.org/pub/gnu/libtool
We require version 1.4 or higher
We recommend version 1.5 or higher

You must have automake installed to compile ntop.Download the appropriate package for your distribution, or get the
source tarball from
ftp://ftp.gnu.org/pub/gnu/automake
We recommend version 1.6.3 or higher
You must have autoconf installed to compile autogen.sh.Download the appropriate package for your distribution, or get the
source tarball from
ftp://ftp.gnu.org/pub/gnu/autoconf
We recommend version 2.53 or higher

看到上面的提示信息是需要libtool、automake、autoconf三个软件安装后才能进行ntop的安装
接下来我们根据下面的链接下载这几个软件,并通过编译安装它们:libtool、autoconf、automake。

root@netren:/var/www/ntop-4.0.1# wget http://ftp.gnu.org/pub/gnu/libtool/libtool-2.4.tar.gz
root@netren:/var/www/ntop-4.0.1# wget http://ftp.gnu.org/pub/gnu/automake/automake-1.9.6.tar.gz
root@netren:/var/www/ntop-4.0.1# wget http://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.68.tar.gz

libtool编译方法示范:(autoconf、automake)

1、tar zvxf libtool-2.4.tar.gz(解压缩下载的文件)

2、cd libtool-2.4(进入解压缩后的目录)

3、./configure   (进行Makefile文件制作)

4、make           (编译)

5、make install  (建议后安装)


autoconf安装时如果提示:
checking for GNU M4 that supports accurate traces... configure: error: no acceptable m4 could be found in $PATH.
GNU M4 1.4.6 or later is required; 1.4.14 is recommended
则表示需要先安装M4,在
http://ftp.gnu.org/gnu/m4/中可用下载,我们使用的是m4-1.4.9.tar.gz



安装完以上软件后,回到ntop的目录,继续安装过程....

重新运行#bash autogen.sh

.......

checking for pcap_lookupdev in -lpcap... no
*** FATAL ERROR ***
It looks that you don't have the libpcap distribution installed.
Download, compile and, optionally, install it.
When finished please re-run this program.
You can download the latest source tarball at
http://www.tcpdump.org/
configure: error:  The LBL Packet Capture Library, libpcap, was not found!

此错误信息为缺少libpcap(网络数据窥探软件),并提示需要下载安装后再试。

通过www.tcpdump.org下载libpcap-1.1.1进行编译安装,同样安装libpcap也依赖其他的软件包:flex、yacc(binson)

configure: error: Your operating system's lex is insufficient to compile
libpcap.  flex is a lex replacement that has many advantages, including
being able to compile libpcap.  For more information, see
http://www.gnu.org/software/flex/flex.html .

提示需要安装flex,yacc(语言编译器)这好办:

apt-get install flex bison 搞定,然后再完成libpcap的安装。

 

再次运行ntop的./configure,还是会报错的,就像我最初所讲的:“因为它依赖的太多程序”你应该根据提示安装相应的程序,如下提示:
checking for gdbm_open in -lgdbm... no

*******************************************************************
*
* ERROR: gdbm header or library routines are missing
*           (yes means it was found, no means it was not found)
*
*              gdbm.h...no
*              gdbm_open() in -lgdbm...no
*
*>>> No way to proceed.
*
*???     1. Install libgdbm
*???    and Rerun ./configure
*???  or 2. Use the --with-gdbm-xxxxx= options
*
*******************************************************************
libgdbm(apt-get install libgdbm-dev)

 

zlib(到www.zlib.net下载相应安装包进行./configure编译安装)

libcairo2(cairo的安装apt-get install libcairo2-dev)

libxml2(libxml2的安装apt-get install libxml2-dev)

gettext (http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz 下载安装)(glib需要)

glib (ftp://ftp.gtk.org/pub/glib/2.27/进行下载后编译安装  )(pangocairo需要)

 

python (apt-get install python-dev) (rrdtool需要)

freetype-2.4.4(可在http://download.savannah.gnu.org/releases/freetype/进行下载后编译安装)(rrdtool需要)

pangocairo (http://ftp.gnome.org/pub/GNOME/sources/pango/1.17进行下载后编译安装)(rrdtool需要)

安装以上软件后下载rrdtool源码进行安装(http://oss.oetiker.ch/rrdtool/pub/?M=D 下载rrdtool-1.4.4编译安装)

 

#tar zvxf rrdtool-1.4.4

#cd rrdtool-1.4.4

#./configure --prefix=/usr/local/rrdtool/(在这里指定好安装目录,有助于以后ntop程序编译时使用)

#make;make install

完成rrdtool安装后,还需要安装GeoIP

GeoIP-1.3.14.tar.gz 可以在http://download.chinaunix.net/down.php?id=7018&ResourceID=3666&site=1下载然后编译安装。


至此,应该可以进行ntop的正式安装了。

回到ntop-4.0.1目录

#cd ntop-4.0.1

#./autogen.sh --prefix=/usr/local/ntop/  这样整个ntop软件将安装在这个目录里面,包括可执行文件./bin/ntop 和日志目录./var/ntop

#make;make install

完成后会提示:


************************************************************
WARNING: This install created a directory for the ntop
files and databases:
//var/local/ntop/share/ntop
This directory MUST be owned by the user
which you are going to use to run ntop.
The command you must issue is something like:
chown -R ntop.ntop //var/local/ntop/share/ntop
or    chown -R ntop:users //var/local/ntop/share/ntop
man chown to check the syntax for YOUR system
************************************************************

按照提示,useradd notp(建立notp用户和组)

chown -R ntop.ntop /var/local/ntop/share/ntop(授予ntop用户管理这个目录的权限)

完成编译。

 

配置ntop
# useradd ntop

# chown –R ntop.ntop /var/local/ntop/share/ntop  
#./ntop –A     (设置密码:输入两遍admin即可)
# /var/local/ntop/bin/ntop  -u ntop (-u 用ntop用户启动服务)

配置完成.

IP输入: http:// ip:3000 就OK 了.

安装问题及除错:

1、如果你无论如何都无法用 http:// ip : 3000进行显示,请查看您的iptables设置,是否允许通过3000端口对本机的访问。

你可以这样做:#iptables -I INPUT -p tcp -m tcp --dport 3000 -j ACCEPT

2、启动ntop时提示: **ERROR** RRD: Disabled - unable to create base directory (err 13, /var/local/ntop/var/ntop/rrd)

其实这时程序已经在运行,你可以通过http:// ip : 3000查看到ntop界面。但是,由于程序没有按规定运行,所以显示不了精准的数据结果。启动过程会提示:NOTE: -L | --use-syslog=facility not specified, child processes will log to the default (24).

打开http:// ip : 3000 你可能会看到如下错误提示:

Network Load Statistics

NOTE: this page is not operational when the RRD plugin is disabled, misconfigured or missing. Please check the ntop log file.

那造成以上问题的原因是什么呢?

原因:ntop启动要创建 /var/local/ntop/var/ntop/rrd及一些子目录flows  graphics  interfaces等,运行者权限不够时无法创建这些目录,因此程序无法正常启动。

解决方法1:

ntop -u ntop (指定ntop用户启动)

解决方法2:(如果继续用root启动)

#mkdir  /var/local/ntop/var/ntop/rrd

#chmod -R 777 /var/local/ntop/var/ntop/rrd

3、编译过程中出现:
configure: error: in `/var/local/libtool-2.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
是因为系统缺少C编译解释器。运行命令安装即可:

root@netren:/var/local/libtool-2.4# apt-get install gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:(下面的包将安装)
binutils gcc-4.4 libc-dev-bin libc6-dev libgomp1 linux-libc-dev manpages-dev
Suggested packages: (涉及到的关联包)
binutils-doc gcc-multilib autoconf automake1.9 libtool flex bison gdb
gcc-doc gcc-4.4-multilib libmudflap0-4.4-dev gcc-4.4-doc gcc-4.4-locales
libgcc1-dbg libgomp1-dbg libmudflap0-dbg libcloog-ppl0 libppl-c2 libppl7
glibc-doc
The following NEW packages will be installed:(如下的包将要新装)
binutils gcc gcc-4.4 libc-dev-bin libc6-dev libgomp1 linux-libc-dev
manpages-dev
0 upgraded, 8 newly installed, 0 to remove and 4 not upgraded. (没有需要更新包,8个需要新装包,没有需要变动的包)
Need to get 12.0MB of archives.  (需要下载12m的包数据)
After this operation, 42.1MB of additional disk space will be used. (安装后将占用42.1MB的磁盘空间)
Do you want to continue [Y/n]? y    (要不要这样做[Y/n]? )
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值