Ntopng 是一套開源的網路流量監察工具, 也是 ntop 的新一代版本, 可以通過網頁介面實時檢視網路使用量。以下是在 RHEL 7 及 CentOS 7 安裝 Ntopng 的方法。
用 yum 安裝 Ntopng 需要使用 EPEL Repo, 如果沒有安裝 EPEL 需要先安裝:
- # yum install epel-release -y
然後建立 ntop repo, 建立檔案 /etc/yum.repos.d/ntop.repo:
- # vi /etc/yum.repos.d/ntop.repo
加入以下內容:
[ntop]
name=ntop packages
baseurl=http://www.nmon.net/centos-stable/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.nmon.net/centos-stable/RPM-GPG-KEY-deri
[ntop-noarch]
name=ntop packages
baseurl=http://www.nmon.net/centos-stable/$releasever/noarch/
enabled=1
gpgcheck=1
gpgkey=http://www.nmon.net/centos-stable/RPM-GPG-KEY-deri
name=ntop packages
baseurl=http://www.nmon.net/centos-stable/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.nmon.net/centos-stable/RPM-GPG-KEY-deri
[ntop-noarch]
name=ntop packages
baseurl=http://www.nmon.net/centos-stable/$releasever/noarch/
enabled=1
gpgcheck=1
gpgkey=http://www.nmon.net/centos-stable/RPM-GPG-KEY-deri
在 vi 儲存檔案及離開:
:wq
執行以下指令安裝 Ntopng 及 Redis:
- # yum –enablerepo=epel install redis ntopng -y
安裝好 Ntopng h 後, 需要安裝 hiredis-devel 套件, 而且在啟動 Ntopng 前要先啟動 Redis:
- # yum –enablerepo=epel install hiredis-devel
啟動 Redis 及設定開機自動啟動:
-
# systemctl start redis.service
# systemctl enable redis.service
現在可以啟動 Ntopng:
Let’s start ntopng and add the service to start at boot time:
-
# systemctl start ntopng.service
# systemctl enable ntopng.service
Ntopng 的設定檔預設在 /etc/ntopng/ntopng.conf, 開啟這個設定檔:
- # vi /etc/ntopng/ntopng.conf
加入以下兩行:
-G=/var/tmp/ntopng.pid\
–community
–community
在 vi 儲存檔案及離開, 重新啟動 Ntopng:
- # systemctl restart ntopng
Ntopng 預設使用 port 3000, 需要在 firewalld 開通 port 3000:
- # firewall-cmd –permanent –add-port=3000/tcp
重新載入 Firewalld:
- # firewall-cmd –reload
完成後, 可以嘗試用瀏覽器開啟 Ntopng 的網頁介面, 在瀏覽器進入主機的 IP, 並在後加指令使用 port 3000:
http://your.server.ip:3000
預設使用者名稱及密碼均是 “admin”, 登入後會提示修改密碼, 修改密碼後便安裝完成了。