ntopng依赖mysql_Centos7搭建npm网络分析工具(ntopng)

部署的时候实在是遇到的坑太多了,必须记录一下

安装依赖包

安装epelyum install epel-release

安装工具包yum groupinstall “Development Tools”

或者(推荐):yum install subversion autoconf automake autogen libpcap-devel GeoIP-devel hiredis-devel redis glib2-devel libxml2-devel sqlite-devel gcc-c++ libtool wget libcurl-devel pango-devel cairo-devel libpng-devel git

安装ntopng

Git Clone太慢可以参考我这篇文章:

[root@localhost ~]# mkdir npm

[root@localhost ~]# cd npm/

安装nDPI[root@localhost npm]# git clone https://github.com/ntop/nDPI.git

[root@localhost npm]# cd nDPI

[root@localhost nDPI]# ./autogen.sh

[root@localhost nDPI]# make

[root@localhost nDPI]# make install

安装ntopng[root@localhost npm]# git clone https://github.com/ntop/ntopng.git

[root@localhost npm]# cd ntopng

[root@localhost ntopng]# ./autogen.sh

[root@localhost ntopng]# ./configure

[root@localhost ntopng]# make

[root@localhost ntopng]# make install #这一步有点慢

若中途会出现MySQL libraries not found ** 错误

安装mysql依赖包[root@localhost ntopng]# yum list \*mysql\* | grep dev

[root@localhost ntopng]# yum install ***

继续安装ntopng[root@localhost ntopng]# /usr/bin/gmake geoip

[root@localhost ntopng]# make

[root@localhost ntopng]# make install

配置ntopng[root@localhost ntopng]# cd /etc/

[root@localhost etc]# mkdir ntopng

[root@localhost ntopng]# vim ntopng.conf

-G=/var/tmp/ntopng.pid

--local-networks=192.168.10.0/24

--interface=eth0

--user=root

启动ntopng[root@localhost ntopng]# systemctl start redis

[root@localhost ntopng]# systemctl enable redis

[root@localhost ntopng]# nohup /usr/local/bin/ntopng /etc/ntopng/ntopng.conf > /tmp/ntopng.log 2>&1 &

启动之后可以在/tmp目录下生成ntopng.log,里面记录的npm的启动日志,可以看下

登录ntopng

Web访问:

228331bfbe85e1977c26fabe89e55e35.png

默认密码为: admin admin

首次登录需要修改密码和修改lang,这里建议是英语,当然你喜欢其他的也无所谓

登录后界面如下:

874dda12d13eca07715a35915261f2f7.png

更多

conf文件解释-G=/var/tmp/ntopng.pid # ntopng的PID文件路径

--local-networks=192.168.10.0/24 #本地可以通信的网段

--interface=eth0 # 本地主机名称

--user=root #以root用户运行

遇到的错误&解决办法

启动时报错:[root@localhost ntopng]# nohup: ignoring input and appending output to ‘nohup.out’

[1]+ Exit 127 nohup /usr/local/bin/ntopng /etc/ntopng/ntopng.conf

查看日志:[root@localhost ntopng]# cat /tmp/ntopng.log

/usr/local/bin/ntopng: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

这个我郁闷了很久,说是没有这个库的文件什么的,我yum install libmysqlclient 提示没有这个包,用node.js的npm install mysql-libmysqlclient还是不行,最后find这个文件才发现是有的,不过是要创建链接文件,太坑了吧!!!:[root@Monitor1921683204 ntopng]# find / -name libmysqlclient*

省略...

/usr/local/mysql/lib/libmysqlclient.so.20

[root@Monitor1921683204 ntopng]# ln -sv /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/libmysqlclient.so.20

重新启动即可

至此,完成npm ntopng部署

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值