一、介绍
ntopng 高速的基于Web的流量分析与集流工具。ntopng是NTOP的新一代版本,官方原先版本的NTOP已经不再更新。ntopng是原ntop下一代版本,网络流量实时监控显示。ntop是基于Libpcap和它被写在一个可移植的方式来运行在UNIX平台上,MacOSX和Win32一样。再稍微具体点的自行上网查,下面连接是github和官网。
二、安装
在官网中和github上面这些其实都有,简单重复下:
我使用的是Centos平台,需要安装一些依赖的软件包,首先是开发工具的一大堆包
yum groupindatll ‘Development Tools‘
随后安装各种依赖的小包,github上有详细的介绍,每个ntopng的版本可能依赖不同,但是大体上没什么具体的变化
yum install subversion autoconf automake autogen libpcap-devel GeoIP-devel hiredis-devel glib2-devel libxml2-devel sqlite-devel gcc-c++ libtool wget libcurl-devel pango-devel cairo-devel libpng-devel git
在github上是给出了 yum 安装 redis 数据库,但这里我想使用编译来安装redis,使用的版本是redis-4.0.11.tar,将软件包放在/usr/local目录下,如下:
cd /usr/local tar -xvf redis-4.0.11.tar cd redis-4.0.11.tar make make install #提示缺什么软件包就安什么,干就完了
简单的配置一下redis,如下:
cd /usr/local/redis-4.0.11/utils #这个下面有些好东西,会用到 cp -ra redis_init_script /etc/init.d/redis #可以简单的扫一眼这个文件内容,看依赖哪个文件夹下面的配置
如图可以看到,依赖一个/etc/redis/6379.conf 的文件,那就安排上
cd /usr/local/redis-4.0.11/utils
cp -ra redis.conf /etc/redis/6379.conf
redis启动的时候默认是在前台启动的,咱们可以改下配置文件放到后台,编辑它的配置文件,改一个yes 就可以的
然后就可以chkconfig --add redis , service redis start 之类的
下面回到 ntopng
cd /usr/local/ mkdir ntopng cd ntopng git clone git://github.com/ntop/ntopng.git #有点慢,等一等就好 git clone git://github.com/ntop/nDPI.git #nDPI是ntopng依赖的,我可能解释有误,可以自行到官网看一看 #下载完成后 cd nDPI/ ./autogen.sh ./configure make #到此为止,这一块就完了,下面重头戏,你会发现你缺少好多的依赖包 cd /usr/local 下载一个libmaxminddb-1.4.2.tar.gz,geoIP会用到该包 tar -xvf libmaxminddb-1.4.2.tar.gz cd libmaxminddb-1.4.2 ./configure make make install ldconfig
这里有一个坑,在后面编译 ntopng 的时候 才会报出来,是关于集成在ntopng的tar包中的一个问题,在 /usr/local/ntopng/third-party/zeromq-4.1.7 下面,这个zeromq是有问题的,缺少一些东西,
问题如下所示:
cd /root/ntopng/third-party/zeromq-4.1.7; ./configure --without-documentation --without-libsodium; make configure: error: cannot find install-sh, install.sh, or shtool in config "."/config make[1] : on entre dans le répertoire ? /root/ntopng/third-party/zeromq-4.1.7 ? Makefile:2497: tweetnacl/src/.deps/libzmq_la-tweetnacl.Plo: Aucun fichier ou dossier de ce type make[1]: *** Aucune règle pour fabriquer la cible ? tweetnacl/src/.deps/libzmq_la-tweetnacl.Plo
我查找了论坛的一些评论才发现问题所在,解决方法如下
查找GitHub: Seems install-sh, install.sh, or shtool is not present in /root/ntopng/third-party/zeromq-4.1.7 解决方法: wget https://github.com/zeromq/zeromq4-1/releases/download/v4.1.7/zeromq-4.1.7.tar.gz -O /tmp/zeromq-4.1.7.tar.gz tar xf /tmp/zeromq-4.1.7.tar.gz -C /root/ntopng/third-party/
还有就是Geoip的用法,发现是仅仅把他们放在特定目录下即可
Maxmind has changed its databases and library and ntopng has been updated as well to keep this into account. GeoLite2-ASN.mmdb GeoLite2-City.mmdb are the new file databases: ?if you are installing a packaged version of ntopng, those files will be pulled in automatically ?if you are building ntopng from sources, you can run make geoip to download them Then, just place them under httpdocs/geoip/ and ntopng will automatically pick them.
所以你可以自行去maxmind的网站上下载这些,GeoLite2-ASN_20200225.tar.gz GeoLite2-City_20200225.tar.gz GeoLite2-Country_20200225.tar.gz
解压后放在目录中,继续进行编译ntopng
cd /usr/local/ntopng ./autogen.sh ./configure make make install
就这样完成了,下面进行一些基本的配置,但需要参考说明,https://www.ntop.org/guides/ntopng/cli_options.html
mkdir -pv /etc/ntopng/ cp -ra /usr/local/ntopng/contrib/ntopng.conf.example /etc/ntopng/ntopng.conf
随后执行命令,ntopng /etc/ntopng/ntopng.conf,连接3000短裤就可以看到界面了,一些小的细节可以自行进行微调。
原文:https://www.cnblogs.com/hjc4025/p/12454528.html