安裝必要的套件
1
2
3
4
|
sudo apt-get install gcc flex librrd-dev make libglib2.0-dev libxml2-dev apache2 libapache2-mod-php7.0 \
php7.0 php7.0-fpm php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-json php7.0-mbstring php7.0-mysql php7.0-tidy php7.0-xml php7.0-zip \
nfdump rrdtool librrds-perl librrdp-perl librrd-dev libmailtools-perl libio-socket-ssl-perl \
-y
|
安裝 perl 的 Socket6 套件
1
|
sudo perl -MCPAN -e 'install Socket6'
|
下載並解壓縮 nfsen
1
2
|
wget http://sourceforge.net/projects/nfsen/files/stable/nfsen-1.3.6p1/nfsen-1.3.6p1.tar.gz
tar -zxvf nfsen-1.3.6p1.tar.gz
|
複製設定檔,並建立 nfsen 目錄
1
2
|
sudo cp nfsen-1.3.6p1/etc/nfsen-dist.conf /etc/nfsen.conf
sudo mkdir -p /data/nfsen
|
修改設定 ( /etc/nfsen.conf )
1
2
3
4
5
6
7
8
9
10
11
|
$PREFIX = '/usr/bin';
$USER = "www-data";
$WWWUSER = "www-data";
$WWWGROUP = "www-data";
%sources = (
'data-source' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' },
);
|
設定修改完畢後,執行 install.pl
1
|
sudo ./install.pl /etc/nfsen.conf
|
啟動服務
1
|
sudo /data/nfsen/bin/nfsen start
|
設定開機自動啟動
1
2
|
sudo ln -s /data/nfsen/bin/nfsen /etc/init.d/nfsen
sudo update-rc.d nfsen defaults 20
|
Reference: Installation and configuration of NFDUMP and NfSen on Ubuntu | TerralTech