[Netflow] NFSen install

安裝必要的套件

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 套件

sudo perl -MCPAN -e 'install Socket6'

 

下載並解壓縮 nfsen

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 目錄

sudo cp nfsen-1.3.6p1/etc/nfsen-dist.conf /etc/nfsen.conf
sudo mkdir -p /data/nfsen

 

修改設定 ( /etc/nfsen.conf )

$PREFIX  = '/usr/bin';

$USER = "www-data";

$WWWUSER = "www-data";

$WWWGROUP = "www-data";

%sources = (
    'data-source' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' },
);

 

設定修改完畢後,執行 install.pl

sudo ./install.pl /etc/nfsen.conf

 

啟動服務

sudo /data/nfsen/bin/nfsen start

 

設定開機自動啟動

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