2014年8月5日 星期二

[研究] NTOP 5.0.1 快速安裝程式(tar.gz)(CentOS 7.0 x64_86)

[研究] NTOP 5.0.1 快速安裝程式(tar.gz)(CentOS 7.0 x64_86)

2014-08-05

NTOP 5.0.1 是 2012-08-13 釋出,很久沒更新了。

CentOS 7.0 沒有提供 yum 安裝 ntop,所以這篇是下載 tar.gz 安裝 小弟寫了 install.sh 快速安裝程式

install.sh 內容

# install.sh
echo -e "\033[31;42m ********** Install ntop 5.0.1.tar.gz on CentOS 7.0 x64_86 ********** \033[0m"
echo -e "\033[31m 2014/08/05 ********** \033[0m"
echo -e "\033[31m by Shau-Rong Lu ********** \033[0m"

# Check SELinux status
if  [ "`grep SELINUX=disabled /etc/selinux/config`" == "" ]; then

# disable SELinux now
/usr/sbin/setenforce 0

# disable SELinux after every reboot
# echo "/usr/sbin/setenforce 0" >> /etc/rc.local  

#or
# disable SELinux always
sed -i -e "s@SELINUX=enforcing@#SELINUX=enforcing@"   /etc/selinux/config
sed -i -e "s@SELINUX=permissive@#SELINUX=permissive@"   /etc/selinux/config
sed -i -e "/SELINUX=/aSELINUX=disabled"   /etc/selinux/config
fi

# Kill yum on running...
ProcessID="`ps aux | grep yum | awk '{print $2}' `"
for i in $ProcessID
do
  echo $i
  kill -9 $i
done

systemctl   stop  firewalld

yum -y install subversion gcc gcc-c++ libpcap-devel libpcap  libtool  automake  autoconf  gdbm  gdbm-devel libevent libevent-devel rrdtool rrdtool-devel zlib zlib-devel python python-devel geoip geoip-devel

wget http://nchc.dl.sourceforge.net/project/ntop/ntop/Stable/ntop-5.0.1.tar.gz
#wget http://sourceforge.net/projects/ntop/files/ntop/Stable/ntop-5.0.1.tar.gz/download

tar -zxvf ntop-5.0.1.tar.gz
cd ntop-5.0.1
./autogen.sh
make
make install

useradd -M -s /sbin/nologin -r ntop
chown -R ntop:root /usr/local/var/ntop/
chown -R ntop:ntop /usr/local/share/ntop/
ntop -A
/usr/local/bin/ntop -d -L -u ntop -P /usr/local/var/ntop --skip-version-check --use-syslog=daemon
# or
#/usr/local/bin/ntop -i "eth0,eth1" -d -L -u ntop -P /usr/local/var/ntop --skip-version-check --use-syslog=daemon
firefox http://localhost:3000/ &



執行成功訊息
[root@localhost ntop-5.0.1]# /usr/local/bin/ntop -d -L -u ntop -P /usr/local/var/ntop --skip-version-check --use-syslog=daemon
Tue Aug  5 16:51:14 2014  Initializing gdbm databases

檢查
[root@localhost ntop-5.0.1]# ps aux | grep ntop
ntop     29090  0.0  1.3 765796 25224 ?        Ssl  16:51   0:00 /usr/local/bin ntop -d -L -u ntop -P /usr/local/var/ntop --skip-version-check --use-syslog daemon
root     29100  0.0  0.0 112640   980 pts/1    R+   16:51   0:00 grep --color=auto ntop
[root@localhost ntop-5.0.1]#


(下圖) 沒有設定 -i 參數 ( 指定網路卡) 時候畫面

 刪除舊程序,指定監控 eno16777736 和 lo 兩張網路卡情況如下:

[root@localhost ntop-5.0.1]# kill -9 29090

[root@localhost ntop-5.0.1]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.128.101  netmask 255.255.255.0  broadcast 192.168.128.255
        inet6 fe80::20c:29ff:feef:d26d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:ef:d2:6d  txqueuelen 1000  (Ethernet)
        RX packets 140794  bytes 177502985 (169.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47663  bytes 3777839 (3.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 7920  bytes 1825738 (1.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7920  bytes 1825738 (1.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ntop-5.0.1]# /usr/local/bin/ntop -d -L -u ntop -P /usr/local/var/ntop --skip-version-check --use-syslog=daemon -i "eno16777736,lo"
Tue Aug  5 16:55:15 2014  Initializing gdbm databases

[root@localhost ntop-5.0.1]# ps aux | grep ntop
ntop     29258  0.1  2.5 795536 47416 ?        Rsl  16:55   0:00 /usr/local/bin ntop -d -L -u ntop -P /usr/local/var/ntop --skip-version-check --use-syslog daemon -i eno16777736,lo
root     29269  0.0  0.0 112640   976 pts/1    R+   16:55   0:00 grep --color=auto ntop
[root@localhost ntop-5.0.1]#






(完)

相關

[研究] ntopng 1.2.2 安裝(svn)(CentOS 7.0 x86_64)
http://shaurong.blogspot.com/2014/09/ntopng-122-centos-70-x8664.html

[研究] NTOPNG 1.2.2 (yum)安裝 (CentOS 6.5 x86_64)
http://shaurong.blogspot.com/2014/09/ntopng-122-yum-centos-65-x8664.html

[研究] NTOPNG 1.1 (yum)安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.com/2013/11/ntopng-11-yum-centos-64-x64.html

[研究] NTOP 5.0.1 快速安裝程式(tar.gz)(CentOS 7.0 x64_86)
http://shaurong.blogspot.com/2014/08/ntop-501-targzcentos-70-c6486.html


2 則留言:

  1. 請問如果忘記登入帳密要如何重罝呢?預設是admin : admin , 我改後,因一段時間沒登入忘記了,謝謝!

    回覆刪除
    回覆
    1. ntop 4.x 好像可用 ntop --set-admin-password 重設密碼,但到 4.y 版就取消了;5.x 版不知道

      刪除