Linux安装高版本tshark(3.x版本)

文章目录

  • 1. 背景
  • 2. 下载源代码并解压
  • 3. 安装cmake3等依赖库
  • 4. 编译安装tshark
    • 4.1 BUG解决大法

1. 背景

  最近在复现一篇将BERT应用在加密流量检测上的paper,其中需要用到高版本的tshark。由于服务器对应的操作系统为Centos,而通过yum命令安装版本较低,如下图所示:

yum provides tshark(搜索库)

Linux安装高版本tshark(3.x版本)_第1张图片
  可以看到tshark是wireshark中的一个组件,如果通过yum install wireshark-1.10.14-25.el7.x86_64则会得到版本为1.10.14的tshark。
在这里插入图片描述
  既然无法通过yum安装高版本tshark,那只能使用源代码安装大法。

2. 下载源代码并解压

  需要注意的是wget中选项-c表示的是断点续传,所以强烈建议加上该选项。

wget -c http://ftp.uni-kl.de/pub/wireshark/src/all-versions/wireshark-3.2.3.tar.xz
tar -xvf wireshark-3.2.3.tar.xz

3. 安装cmake3等依赖库

  由于源代码安装需要用到cmake3进行编译,通过yum命令进行安装

yum install cmake3 glib2-devel libpcap libpcap-devel libgcrypt-devel glib2-devel qt-devel qt5-qtbase-devel qt5-linguist qt5-qtmultimedia-devel qt5-qtsvg-devel libcap-devel libcap-ng-devel gnutls-devel krb5-devel libxml2-devel lua-devel lz4-devel snappy-devel spandsp-devel libssh2-devel bcg729-devel libmaxminddb-devel sbc-devel libsmi-devel libnl3-devel libnghttp2-devel libssh-devel libpcap-devel c-ares-devel redhat-rpm-config rpm-build gtk+-devel gtk3-devel desktop-file-utils portaudio-devel rubygem-asciidoctor docbook5-style-xsl docbook-style-xsl systemd-devel python34 cmake3 git gcc gcc-c++ flex bison doxygen gettext-devel libxslt cmake

4. 编译安装tshark

cd wireshark-3.2.3
cmake3 . -DCMAKE_EXE_LINKER_FLAGS='-static-libstdc++' 
make -i -j 16 
make install

4.1 BUG解决大法

  如果在make -i -j 16时出现以下错误:

/home/anaconda3/lib/libQt5Widgets.so.5.9.5: undefined reference to `operator delete[](void*, unsigned long)@CXXABI_1.3.9'
/home/anaconda3/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'
/home/anaconda3/lib/libQt5Core.so.5.9.5: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
/home/anaconda3/lib/libQt5Multimedia.so.5.9.5: undefined reference to `operator delete(void*, unsigned long)@CXXABI_1.3.9'

  或者是:

/home/anaconda3/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'

  最简单的解决方案是先将anaconda的文件夹进行重命名,然后安装后再重新改回来。曾经尝试各种其他方法也无法顺利安装,如果有更好的方法欢迎大佬在留言区分享。

你可能感兴趣的:(Linux由浅入深,Linux,tshark)