ubuntu12.04TLS下源码编译安装wireshark

一、环境以及一些源码说明

     系统:ubuntu12.04TLS 64位

     源码:wireshark-1.12.7.tar.bz2,libtool-2.4.6.tar.gz ,libpcap-1.7.4.tar.gz

     安装路径: /opt/wireshark


二、安装步骤

    1. 首先安装一些依赖的工具以及库

        sudo apt-get update 先更新下软件镜像站点

         sudo apt-get install flex

         sudo apt-get install bison

         sudo apt-get install autoconf

         sudo apt-get install libqt4-dev

         sudo apt-get install libgtk2.0-dev

        安装libtool(使用源码安装):

            (1)解压$tar -xzf libtool-2.4.6.tar.gz

            (2)进入解压后的目录 $cd libtoo-2.4.6

            (3) 安装三部曲 $./configure; make ; sudo make install


     2.安装libcap

            (1) 解压 $tar -xzf libpcap-1.7.4.tar.gz

            (2) 进入解压后的目录 $cd libpcap-1.7.4

            (3) $./configure

            (4) $make

            (5) $sudo make install

     3.然后解压wiresharek源码,进入解压目录,进行安装三部曲。

            (1) $tar -xjf wiresharek-1.12.7.tar.bz2

            (2) $cd wiresharek-1.12.7

            (3) $./configure --prefix=/opt/wireshark --with-gtk2 (因为默认使用gtk3,所以指定使用gtk2)

            (4) $make

            (5) $sudo make install


    三、安装过程中遇到的问题以及解决方法

        (1)安装libpcap时

               <1> $./configure

                    报错:

                    checking for flex... no

                    checking for bison... no

                    checking for capable lex... insufficient

                    configure: error: Your operating system's lex is insufficient to compile

                    libpcap.  flex is a lex replacement that has many advantages, including

                    being able to compile libpcap.  For more information, see

                    http://www.gnu.org/software/flex/flex.html .

                    解决:

                   $sudo apt-get install flex

              <2>$make 

                    报错:

                    ./runlex.sh lex -oscanner.c scanner.l

                    mv scanner.c scanner.c.bottom

                    cat ./scanner.c.top scanner.c.bottom > scanner.c

                    yacc -d grammar.y

                    make: yacc:命令未找到

                    make: *** [grammar.c] 错误 127

                    解决:

                   $sudo apt-get install bison

        (2)编译wireshark

            <1>$./autogen.sh

                报错:

                 ./autogen.sh: 1: ./autogen.sh: autoconf: not found

                 You must have autoconf 2.60 or later installed to compile Wireshark.

                 Download the appropriate package for your distribution/OS,

                 or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/

                ./autogen.sh: 1: ./autogen.sh: automake: not found

                 You must have automake 1.9 or later installed to compile Wireshark.

                 Download the appropriate package for your distribution/OS,

                 or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/

                ./autogen.sh: 1: ./autogen.sh: libtool: not found

                 You must have libtool 1.4 or later installed to compile Wireshark.

                 Download the appropriate package for your distribution/OS,

                 or get the source tarball at ftp://ftp.gnu.org/pub/gnu/libtool/

                解决:

                $sudo apt-get insall autoconf

                安装libtool

            <2>$./configure --prefix=/opt/wireshark

                报错:

                checking for pkg-config... /usr/bin/pkg-config

                checking for Qt5Core - version >= 4.6.0... no

                checking for QtCore - version >= 4.6.0... no

                configure: error: Qt is not available

                解决:

                $sudo apt-get install libqt4-dev

            

                再次运行$./configure �C-prefix=/opt/wireshark    

                报错:

                gtk+3 no available

                解决:

                $sudo apt-get install libgtk2.0-dev 第一次没有找到

                $sudo apt-get update 更新镜像站点,找到

                $sudo apt-get install libgtk2.0-dev

                

                再次运行$./configure --prefix=/opt/wireshark

                依然报错 gtk+3 no available

                解决:

                    $./configure --prefix=/opt/wireshark --with-gtk2


你可能感兴趣的:(wireshark源码安装)