安裝 ntop 於 CentOS 5 上 (ntop on CentOS 5)

安裝 ntop :

#yum install ntop (從 atomic repository 中找到 ntop 並安裝)

Installed:

  ntop.x86_64 0:3.3.9-7.el5.art

Dependency Installed:

  GeoIP.x86_64 0:1.4.8-1.1.el5.art      graphviz.x86_64 0:2.16.1-1.el5.art

Complete!

#ntop -A

Error Opening file ./GeoLiteCity.dat

Error Opening file ./GeoIPASNum.dat

修改防火牆 3000 port

網頁介面 admin 帳號,密碼如上設定。

#yum remove ntop

#yum remove GeoIP

#yum remove graphviz

http://shomeit.blogspot.com/search/label/cacti

http://im.nuk.edu.tw/~alleyn/net/ntop.htm

http://pkgs.repoforge.org/rpmforge-release/

#wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

#rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

#yum install ntop

Dependencies Resolved

================================================================================

 Package          Arch           Version                 Repository        Size

================================================================================

Installing:

 ntop             x86_64         3.3.9-7.el5.art         atomic            20 M

Installing for dependencies:

 geoip            x86_64         1.4.6-1.el5.rf          rpmforge         754 k

 graphviz         x86_64         2.22.0-4.el5.rf         rpmforge         2.5 M

Transaction Summary

================================================================================

Install       3 Package(s)

Upgrade       0 Package(s)

Total download size: 23 M

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : geoip                                                    1/3

  Installing     : graphviz                                                 2/3

  Installing     : ntop                                                     3/3

Installed:

  ntop.x86_64 0:3.3.9-7.el5.art

Dependency Installed:

  geoip.x86_64 0:1.4.6-1.el5.rf        graphviz.x86_64 0:2.22.0-4.el5.rf

Complete!

看:

這些個地方。

#ls /etc/ntop/

-rw-r--r-- 1 root root    18394  5月  9  2006 etter.finger.os.gz

-rw-r--r-- 1 root root  2204601  3月  3  2010 GeoIPASNum.dat

-rw-r--r-- 1 root root 28937642  3月  3  2010 GeoLiteCity.dat

-rw-r--r-- 1 root root     1977  1月  2  2002 ntop-cert.pem

-rw-r--r-- 1 root root   365488 12月  2  2004 oui.txt.gz

-rw-r--r-- 1 root root      749  4月 24  2003 specialMAC.txt.gz

#vi /etc/ntop.conf

# tells ntop the user id to run as

--user ntop

#save messages into the system log

--use-syslog=daemon

# sets the directory that ntop runs from

--db-file-path /var/lib/ntop

# the amount and severity of messages that ntop will put out

--trace-level 3

# limit ntop to listening on a specific interface and port

改下面這行:

--http-server 127.0.0.1:3000 --https-server 127.0.0.1:3001

變成:

#--http-server 127.0.0.1:3000 --https-server 127.0.0.1:3001

#新增一行如下:

--http-server your.ip.add.ress:3000 --https-server your.ip.add.ress:3001

# Under certain circumstances, the sched_yield() function causes the ntop web

# server to lock up.  It shouldn't happen, but it does.  This option causes

# ntop to skip those calls, at a tiny performance penalty.

--disable-schedyield

# disables "phone home" behavior

--skip-version-check=yes

存檔。

#vi /etc/rc.d/init.d/ntop

一些相關的設定值如下:

# pidfile: /var/run/ntop.pid

# config: /etc/ntop.conf

# Source function library.

. /etc/rc.d/init.d/functions

# Path to the ntop program

prog=ntop

ntop=/usr/sbin/$prog

pidfile=/var/run/$prog.pid

config=/etc/ntop.conf

#ntop -A

設定網頁的管理者 admin 的密碼,打兩次。

Thu May 10 23:58:33 2012  NOTE: Interface merge enabled by default

Thu May 10 23:58:33 2012  Initializing gdbm databases

ntop startup - waiting for user response!

Please enter the password for the admin user:

Please enter the password again:

Thu May 10 23:58:54 2012  Admin user password has been set

啟動 ntop。

#service ntop start

#ntop

Fri May 11 00:05:51 2012  NOTE: Interface merge enabled by default

Fri May 11 00:05:51 2012  Initializing gdbm databases

Fri May 11 00:05:51 2012  **ERROR** ....open of /var/lib/ntop/prefsCache.db failed: Can't be writer

Fri May 11 00:05:51 2012  Possible solution: please use '-P <directory>'

Fri May 11 00:05:51 2012  **FATAL_ERROR** GDBM open failed, ntop shutting down...

Fri May 11 00:05:51 2012  CLEANUP[t47289262100528]: ntop caught signal 2 [state=2]

Fri May 11 00:05:51 2012  ntop is now quitting...

# cd /var/lib/ntop

#chown ntop:ntop *.db

#service ntop restart

http://freeze.blog.51cto.com/1846439/386828

#yum install GeoIP

Is this ok [y/N]: y

Downloading Packages:

GeoIP-1.4.8-1.1.el5.art.x86_64.rpm                       | 782 kB     01:01

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : GeoIP                                                    1/1

Installed:

  GeoIP.x86_64 0:1.4.8-1.1.el5.art

Complete!

#yum install GeoIP-devel

Downloading Packages:

GeoIP-devel-1.4.8-1.1.el5.art.x86_64.rpm                 | 9.8 kB     00:00

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : GeoIP-devel                                              1/1

Installed:

  GeoIP-devel.x86_64 0:1.4.8-1.1.el5.art

Complete!

#yum install libpcap

Downloading Packages:

libpcap-0.9.4-15.el5.i386.rpm                            | 108 kB     00:00

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : libpcap                                                  1/1

Installed:

  libpcap.i386 14:0.9.4-15.el5

Complete!

#yum install libpcap-devel

Downloading Packages:

(1/2): libpcap-devel-0.9.4-15.el5.x86_64.rpm             | 117 kB     00:00

(2/2): libpcap-devel-0.9.4-15.el5.i386.rpm               | 119 kB     00:00

--------------------------------------------------------------------------------

Total                                           607 kB/s | 236 kB     00:00

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : libpcap-devel                                            1/2

  Installing     : libpcap-devel                                            2/2

Installed:

  libpcap-devel.i386 14:0.9.4-15.el5    libpcap-devel.x86_64 14:0.9.4-15.el5

Complete!

#yum install gdbm gdbm-devel zlib zlib-devel

Setting up Install Process

Package gdbm-1.8.0-26.2.1.el5_6.1.x86_64 already installed and latest version

Package gdbm-1.8.0-26.2.1.el5_6.1.i386 already installed and latest version

Package zlib-1.2.3-4.el5.x86_64 already installed and latest version

Package zlib-1.2.3-4.el5.i386 already installed and latest version

Resolving Dependencies

--> Running transaction check

---> Package gdbm-devel.i386 0:1.8.0-26.2.1.el5_6.1 set to be updated

---> Package gdbm-devel.x86_64 0:1.8.0-26.2.1.el5_6.1 set to be updated

---> Package zlib-devel.i386 0:1.2.3-4.el5 set to be updated

---> Package zlib-devel.x86_64 0:1.2.3-4.el5 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

 Package           Arch          Version                      Repository   Size

================================================================================

Installing:

 gdbm-devel        i386          1.8.0-26.2.1.el5_6.1         base         37 k

 gdbm-devel        x86_64        1.8.0-26.2.1.el5_6.1         base         38 k

 zlib-devel        i386          1.2.3-4.el5                  base        101 k

 zlib-devel        x86_64        1.2.3-4.el5                  base        103 k

Transaction Summary

================================================================================

Install       4 Package(s)

Upgrade       0 Package(s)

Total download size: 280 k

Is this ok [y/N]: y

Downloading Packages:

(1/4): gdbm-devel-1.8.0-26.2.1.el5_6.1.i386.rpm          |  37 kB     00:00

(2/4): gdbm-devel-1.8.0-26.2.1.el5_6.1.x86_64.rpm        |  38 kB     00:00

(3/4): zlib-devel-1.2.3-4.el5.i386.rpm                   | 101 kB     00:00

(4/4): zlib-devel-1.2.3-4.el5.x86_64.rpm                 | 103 kB     00:00

--------------------------------------------------------------------------------

Total                                           368 kB/s | 280 kB     00:00

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : gdbm-devel                                               1/4

  Installing     : zlib-devel                                               2/4

  Installing     : zlib-devel                                               3/4

  Installing     : gdbm-devel                                               4/4

Installed:

  gdbm-devel.i386 0:1.8.0-26.2.1.el5_6.1

  gdbm-devel.x86_64 0:1.8.0-26.2.1.el5_6.1

  zlib-devel.i386 0:1.2.3-4.el5

  zlib-devel.x86_64 0:1.2.3-4.el5

Complete!

#yum install libtool

Downloading Packages:

libtool-1.5.22-7.el5_4.x86_64.rpm                        | 667 kB     00:00

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : libtool                                                  1/1

Installed:

  libtool.x86_64 0:1.5.22-7.el5_4

Complete!

#yum install gcc

Reducing CentOS-5 Testing to included packages only

Finished

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package gcc.x86_64 0:4.1.2-52.el5_8.1 set to be updated

--> Processing Dependency: cpp = 4.1.2-52.el5_8.1 for package: gcc

--> Processing Dependency: libgcc >= 4.1.2-52.el5_8.1 for package: gcc

--> Running transaction check

---> Package cpp.x86_64 0:4.1.2-52.el5_8.1 set to be updated

---> Package libgcc.i386 0:4.1.2-52.el5_8.1 set to be updated

---> Package libgcc.x86_64 0:4.1.2-52.el5_8.1 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

 Package        Arch           Version                    Repository       Size

================================================================================

Installing:

 gcc            x86_64         4.1.2-52.el5_8.1           updates         5.3 M

Updating for dependencies:

 cpp            x86_64         4.1.2-52.el5_8.1           updates         2.9 M

 libgcc         i386           4.1.2-52.el5_8.1           updates          97 k

 libgcc         x86_64         4.1.2-52.el5_8.1           updates          99 k

Transaction Summary

================================================================================

Install       1 Package(s)

Upgrade       3 Package(s)

Total download size: 8.4 M

Is this ok [y/N]: y

Downloading Packages:

(1/4): libgcc-4.1.2-52.el5_8.1.i386.rpm                  |  97 kB     00:00

(2/4): libgcc-4.1.2-52.el5_8.1.x86_64.rpm                |  99 kB     00:00

(3/4): cpp-4.1.2-52.el5_8.1.x86_64.rpm                   | 2.9 MB     00:00

(4/4): gcc-4.1.2-52.el5_8.1.x86_64.rpm                   | 5.3 MB     00:00

--------------------------------------------------------------------------------

Total                                           6.5 MB/s | 8.4 MB     00:01

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Updating       : libgcc                                                   1/7

  Updating       : cpp                                                      2/7

  Installing     : gcc                                                      3/7

  Updating       : libgcc                                                   4/7

  Cleanup        : cpp                                                      5/7

  Cleanup        : libgcc                                                   6/7

  Cleanup        : libgcc                                                   7/7

Installed:

  gcc.x86_64 0:4.1.2-52.el5_8.1

Dependency Updated:

  cpp.x86_64 0:4.1.2-52.el5_8.1           libgcc.i386 0:4.1.2-52.el5_8.1

  libgcc.x86_64 0:4.1.2-52.el5_8.1

Complete!

#tar zxvf ntop-4.1.0.tar.gz

#cd ntop-4.1.0

#./autogen.sh

 Unable to find RRD at /usr/local: please use --with-rrd-home=DIR

#yum install rrdtool

Downloading Packages:

(1/6): libdbi-0.8.1-2.1.x86_64.rpm                       |  37 kB     00:00

(2/6): perl-rrdtool-1.4.7-1.el5.rf.x86_64.rpm            |  55 kB     00:00

(3/6): lua-5.1.4-2.el5.rf.x86_64.rpm                     | 235 kB     00:08

(4/6): ruby-1.8.5-24.el5.x86_64.rpm                      | 277 kB     00:00

(5/6): rrdtool-1.4.7-1.el5.rf.x86_64.rpm                 | 916 kB     00:27

(6/6): ruby-libs-1.8.5-24.el5.x86_64.rpm                 | 1.6 MB     00:00

--------------------------------------------------------------------------------

Total                                            75 kB/s | 3.1 MB     00:42

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : lua                                                      1/7

  Installing     : ruby-libs                                                2/7

  Installing     : ruby                                                     3/7

  Installing     : libdbi                                                   4/7

  Updating       : rrdtool                                                  5/7

  Installing     : perl-rrdtool                                             6/7

  Cleanup        : rrdtool                                                  7/7

Dependency Installed:

  libdbi.x86_64 0:0.8.1-2.1                   lua.x86_64 0:5.1.4-2.el5.rf

  perl-rrdtool.x86_64 0:1.4.7-1.el5.rf        ruby.x86_64 0:1.8.5-24.el5

  ruby-libs.x86_64 0:1.8.5-24.el5

Updated:

  rrdtool.x86_64 0:1.4.7-1.el5.rf

Complete!

#yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel libpcap libpcap*

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : freetype-devel                                          1/26

  Updating       : libpng                                                  2/26

  Installing     : glib2-devel                                             3/26

  Installing     : fontconfig-devel                                        4/26

  Installing     : libXau-devel                                            5/26

  Installing     : libpng-devel                                            6/26

  Installing     : libxml2-devel                                           7/26

  Installing     : libxml2-devel                                           8/26

  Installing     : libart_lgpl-devel                                       9/26

  Installing     : freetype-devel                                         10/26

  Installing     : libart_lgpl-devel                                      11/26

  Updating       : libpng                                                 12/26

  Installing     : libpng-devel                                           13/26

  Installing     : xorg-x11-proto-devel                                   14/26

  Installing     : libX11-devel                                           15/26

  Installing     : libXrender-devel                                       16/26

  Installing     : cairo-devel                                            17/26

  Installing     : libXft-devel                                           18/26

  Installing     : libXext-devel                                          19/26

  Installing     : pango-devel                                            20/26

  Installing     : libXdmcp-devel                                         21/26

  Installing     : pango-devel                                            22/26

  Installing     : cairo-devel                                            23/26

  Installing     : mesa-libGL-devel                                       24/26

  Cleanup        : libpng                                                 25/26

  Cleanup        : libpng                                                 26/26

Installed:

  cairo-devel.i386 0:1.2.4-5.el5

  cairo-devel.x86_64 0:1.2.4-5.el5

  freetype-devel.i386 0:2.2.1-31.el5_8.1

  freetype-devel.x86_64 0:2.2.1-31.el5_8.1

  libart_lgpl-devel.i386 0:2.3.17-4

  libart_lgpl-devel.x86_64 0:2.3.17-4

  libpng-devel.i386 2:1.2.10-17.el5_8

  libpng-devel.x86_64 2:1.2.10-17.el5_8

  libxml2-devel.i386 0:2.6.26-2.1.15.el5_8.2

  libxml2-devel.x86_64 0:2.6.26-2.1.15.el5_8.2

  pango-devel.i386 0:1.14.9-8.el5.centos.3

  pango-devel.x86_64 0:1.14.9-8.el5.centos.3

Dependency Installed:

  fontconfig-devel.x86_64 0:2.4.1-7.el5

  glib2-devel.x86_64 0:2.12.3-4.el5_3.1

  libX11-devel.x86_64 0:1.0.3-11.el5_7.1

  libXau-devel.x86_64 0:1.0.1-3.1

  libXdmcp-devel.x86_64 0:1.0.1-2.1

  libXext-devel.x86_64 0:1.0.1-2.1

  libXft-devel.x86_64 0:2.1.10-1.1

  libXrender-devel.x86_64 0:0.9.1-3.1

  mesa-libGL-devel.x86_64 0:6.5.1-7.10.el5

  xorg-x11-proto-devel.x86_64 0:7.1-13.el5

Dependency Updated:

  libpng.i386 2:1.2.10-17.el5_8         libpng.x86_64 2:1.2.10-17.el5_8

Complete!

#yum reinstall rrdtool

Downloading Packages:

rrdtool-1.4.7-1.el5.rf.x86_64.rpm                        | 916 kB     00:01

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : rrdtool                                                  1/1

Installed:

  rrdtool.x86_64 0:1.4.7-1.el5.rf

Complete!

http://renren.it/a/bianchengyuyan/_NET/20120504/161679.html

3、安裝rrdtool

下載最新的rrdtool

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz 

解壓與配置

tar zxf rrdtool-1.4.7.tar.gz  

cd rrdtool-1.4.7  

./configure --prefix=/usr/local/rrdtool  

make  

make install  

#cd /root/ntop-4.1.0/

#./autogen.sh

#make

#make install

# chown -R ntop.ntop /usr/local/share/ntop

#chown -R ntop:root /usr/local/var/ntop/

#ntop -A

//之後打密碼兩次,回應如下:

Mon May 14 16:08:40 2012  NOTE: Interface merge enabled by default

Mon May 14 16:08:40 2012  Initializing gdbm databases

Mon May 14 16:08:40 2012  Setting administrator password...

ntop startup - waiting for user response!

Please enter the password for the admin user:

Please enter the password again:

Mon May 14 16:09:08 2012  Admin user password has been set

Mon May 14 16:09:08 2012  Admin password set...

//設定好 admin 的密碼了。

接下來啟動 ntop:

# ntop -i eth0 -d -L -u ntop

使之開機自動啟動:

#echo 'ntop -i eth0 -d -L -u ntop &> /dev/null' >> /etc/rc.d/rc.local

OR

開機自動啟動

#vi /etc/rc.local

增加代碼:

#/usr/bin/ntop -d -L -u ntop -P /usr/local/var/ntop --skip-version-check --use-syslog=daemon

關閉 ntop:

#killall ntop