Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

64 位元 CentOS 6.4 安裝設定 ntopng:從 yum 源到 Web 介面

ntopng 是即時網路流量監控工具,能自動從流量中萃取有價值的資訊。它相依套件不少,因此安裝的成敗多半取決於「源有沒有配好」。

64 位元 CentOS 6.4 安裝設定 ntopng:從 yum 源到 Web 介面

1. 配置預設 yum 源

先備份:

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.def

下載新的 repo(CentOS 5 與 6 分別對應):

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-5.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

然後 yum makecache 產生快取。

2. 安裝 EPEL 源

wget https://dl.Fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
chmod u+x epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm

若已有其他 EPEL 設定,先備份:

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

換成國內鏡像:

wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-6.repo

3. 安裝相依庫

yum install libpcap-devel glib2-devel GeoIP GeoIP-devel libxml2-devel redis wget rrdtool

接著補 libzmq3:

wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/openSUSE/repositories/home:/jblunck:/messaging/CentOS_CentOS-6/x86_64/libzmq3-3.2.2-5.1.x86_64.rpm
chmod u+x libzmq3-3.2.2-5.1.x86_64.rpm
rpm -ivh libzmq3-3.2.2-5.1.x86_64.rpm

否則安裝 ntopng 時會看到這類相依性錯誤:

librrd.so.4()(64bit) is needed by ntopng
libzmq.so.3()(64bit) is needed by ntopng
rrdtool >= 1.3.8 is needed by ntopng

4. 下載並安裝 ntopng

wget https://www.nmon.net/packages/rpm/x86_64/ntopng/ntopng-1.2.2-8420.x86_64.rpm
wget https://www.nmon.net/packages/rpm/x86_64/ntopng-data/ntopng-data-1.2.2-8420.noarch.rpm
chmod u+x ntopng-1.2.2-8420.x86_64.rpm ntopng-data-1.2.2-8420.noarch.rpm
rpm -ivh ntopng-1.2.2-8420.x86_64.rpm
rpm -ivh ntopng-data-1.2.2-8420.noarch.rpm

5. 設定 ntopng

cd /etc/ntopng/ 後會看到 ntopng.conf.sample 與 ntopng.start。前者是設定範本,後者是啟動時實際讀取的檔案(此版本中為空)。範本內容僅有一行 -G=/var/tmp/ntopng.gid,用來指定行程 ID 檔。

建立 ntopng.conf 並寫入:

-G=/var/tmp/ntopng.pid
--local-networks "10.1.1.0/24"
--interface eth1
--user nobody
--http-port 8888

分別指定本地子網、監聽網卡、執行帳號與 Web 埠(未指定時預設 3000)。

6. 啟動

ntopng 依賴 redis 提供鍵值儲存,務必先啟動:

service redis start
service ntopng start

7. 驗證

瀏覽 https://IP:8888,預設帳號密碼皆為 admin。整體流程中,最容易失敗的環節是相依庫與 yum 源,先把這兩塊做穩,後面幾乎不會出錯。

Copyright © Linux教程網 All Rights Reserved