ローリングコンバットピッチなう!

AIとか仮想化とかペーパークラフトとか

nfdump(netflow collector)インストール

[technology] Ubuntu 18.04 LTSにnfdumpをインストールする(とりあえずインストールするだけ)

一昨日からの続きです。
Linuxで動くCLIベースのnetflow collectorであるnfdumpというツールをUbuntuにインストールします。
インストール先はKVM上で動かしているUbuntu-serverで18.04をほとんど最小構成でインストールしたものです。

nfdumpはgithubで公開されています。

GitHub - phaag/nfdump: Netflow processing tools

で、aptでサクっとパッケージを持ってこれるかと思ったらパッケージが見つからないと無情なお答え。
仕方がないのでgithubからクローンします。

# git clone https://github.com/phaag/nfdump.git

で、中を見るとconfigure.acしか入っていないので、configureから作る必要があるのですが、自分の環境だとbuild-essentialから入れる必要があり色々ググりつつ、また一歩進むたびにエラーが出るのでそのたびにパッケージを追加して結局の下記のパッケージをaptでインストールしました。yacc,lexが使われているのでbisonとflexも必要です。

$ sudo apt install pkg-config
$ sudo apt install -y build-essential libglib2.0-0 libglib2.0-dev autoconf automake libtool
$ sudo apt install flex
$ sudo apt install libbz2-1.0 libbz2-dev
$ sudo apt install bison

さて、これだけパッケージが入ったら、

$ autoreconf -fi
$ ./configure
$ make
$ sudo make install

これで一見成功した様に見えるのですが、ビルド&インストールしたコマンドを実行してみると、

$ nfdump -V
nfdump: error while loading shared libraries: libnfdump-1.6.17.so: cannot open shared object file: No such file or directory

むむ?shared libのロードに失敗してコマンドが実行出来ない。libnfdump-1.6.17.soは/usr/local/libにインストールされていました。
/usr/local/libにライブラリパスが通っていない?

$ cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib

通っています。
ld用のキャッシュを更新してみます。

$ sudo ldconfig
$ ldconfig -v
/sbin/ldconfig.real: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/usr/lib/x86_64-linux-gnu/libfakeroot:
	libfakeroot-0.so -> libfakeroot-tcp.so
/usr/local/lib:
	libnfdump-1.6.17.so -> libnfdump.so
〜以下省略〜

これで通ったか?

$ nfdump -V
nfdump: Version: 1.6.17
$ nfcapd -V
nfcapd: Version: 1.6.17

とりあえずコマンドが起動する様になりました。


動作確認は次回に続く..
rc30-popo.hatenablog.com