之前装过一次,后来时间长了,再重新装又折腾一些时间,于是记录一下。
文章来源:http://www.cnblogs.com/wawahaha/p/3821486.html
1.安装GCC:
yum -y install gcc-c++
2.安装flex:
yum -y install flex
没有flex,直接安装libpcap会提示”Your operating system’s lex is insufficient to compile libpcap”错误;
3.安装bison
yum -y install bison
前面安装的是flex,就需要搭配bison,如不会提示”don’t have both flex and bison;reverting to lex/yacc”错误;
4.安装 libpcap
下载地址:http://www.tcpdump.org/
下载版本:wget -c http://www.tcpdump.org/release/libpcap-1.5.3.tar.gz
解压软件包:tar zxf libpcap-1.0.0.tar.gz
进入解压后的目录,输入命令行:
命令如下:
./configure
make
make install
这几步的安装基本都没问题,就是在linux上运行Jpcap程序的时候跑不起来,问题如下:error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file ordirectory
解决办法:
将libpcap.so.1所在目录添加到文件/etc/ld.so.conf中,
打开ld.so.conf文件,然后添加一行/usr/local/lib:
includeld.so.conf.d/*.conf //原来的内容
/usr/local/lib
然后保存,再终端下执行 ldconfig。
OK.