安裝編譯工具:
$sudo apt-get install build-essential
爲了成功編譯Wireshark,您需要安裝GTK+的開發文件和GLib庫(libraries)。
$sudo apt-get install libgtk2.0-dev libglib2.0-dev
安裝Checkinstall以便管理您系統中直接由源代碼編譯安裝的軟件。
$sudo apt-get install checkinstall
wireshark源碼下載地址:http://www.wireshark.org/download.html(頁 面中的source code)
下載後的文件名:wireshark-1.2.2.tar.bz2
cd到文件目錄解壓:$tar -xvf wireshark-1.2.2.tar.bz2
$cd wireshark-1.2.2
編譯安裝命令如下:
$./configure
$make
$sudo make install
其中make編譯時間會比較長,這樣下來就基本安裝了。
下面是我這篇文章的關鍵,也是用ubuntu安裝的過程中極有 可能遇到的問題,且都是在進行./configure編譯過程中出現,兩個問題如下:
---------------------------------------------------------------------------------------------------------
問題1:
- ./configure執行到最後出錯
- checking for perl... /usr/bin/perl
- checking for bison... no
- checking for byacc... no
- checking for yacc... no
- configure: error: I couldn't find yacc (or bison or ...); make sure it's installed and in your path
解決辦法:
- sudo apt-get install flex bison
yacc(Yet Another Compiler Compiler),是Unix/Linux上一個用來生成編譯器的編譯器(編譯器代碼生成器)。
如想深入瞭解google下。
問題2:
- configure: error: Header file pcap.h not found; if you installed libpcap from source, did you also do "make install-incl", and if you installed a binary package of libpcap, is there also a developer's package of libpcap,
- and did you also install that package?
問題原因是ubuntu下缺少pcap.h等文件。
解決方法:
編譯安裝libpcap.
在www.tcpdump.org頁面中可下載源碼:libpcap- 1.0.0.tar.gz
cd到文件目錄:
- $tar -xvf libpcap-1.0.0.tar.gz
- $cd libpcap-1.0.0.tar.gz
- $./configure
- $make
- $sudo make install
----------------------------------------------------------------------------------------------------------------------------------------------------
採用上面的方法後再回到文章前面的步驟:
$cd wireshark-1.2.2編譯安裝:
$./configure
$make
$sudo make install
這樣就安裝好了。
啓動方法:進入wireshark-1.2.2,輸入命令:
這裏如果不用sudo,則wireshark找不到網絡設備接口,這主要與權限有關,啓動時注意下就行。