部署的时候实在是遇到的坑太多了,必须记录一下
安装依赖包
安装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访问:
默认密码为: admin admin
首次登录需要修改密码和修改lang,这里建议是英语,当然你喜欢其他的也无所谓
登录后界面如下:
更多
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部署