Ubuntu 安装 wireshark

来源:互联网 发布:2016淘宝睡衣模特红人 编辑:程序博客网 时间:2024/05/24 16:17

  在ubuntu下,使用wireshark也是很有必要的。虽然可以使用tcpdump等工具。

ubuntu:11.10
    1. sudo apt-get install wireshark
    出于安全方面的考虑,普通用户不能够打开网卡设备进行抓包,wireshark不建议用户通过sudo在root权限下运行,wireshark为ubuntu(Debian)用户提供了一种在非root下的解决方法。(详细解释可以参考:/usr/share/doc/wireshark-common/README.Debian)

具体步骤:

 

    2. dpkg-reconfigure wireshark-common

“Should non-superusers be able to capture packages?”

选择Yes (默认是no

    3. sudo vim /etc/group

在组策略中会出现wireshark组,默认没有任何用户属于这个组,只需把特定的用户加入组中(需要注销后重新登录来使设置生效)就可以以该用户来运行wireshark实时抓网络数据包

 

安装编译工具:

  $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:

 

[c-sharp] view plaincopy
 
  1. ./configure执行到最后出错  
  2. checking for perl... /usr/bin/perl  
  3. checking for bison... no  
  4. checking for byacc... no  
  5. checking for yacc... no  
  6. configure: error: I couldn't find yacc (or bison or ...); make sure it's installed and in your path  

解决办法:

 

[c-sharp] view plaincopy
 
  1. sudo apt-get install flex bison  

yacc(Yet Another Compiler Compiler),是Unix/Linux上一个用来生成编译器的编译器(编译器代码生成器)。

如想深入了解google下。

 

问题2:

 

[c-sharp] view plaincopy
 
  1. 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,  
  2. and did you also install that package?  

问题原因是ubuntu下缺少pcap.h等文件。

解决方法:

编译安装libpcap.

在www.tcpdump.org页面中可下载源码:libpcap-1.0.0.tar.gz

cd到文件目录:

 

[c-sharp] view plaincopy
 
  1. $tar -xvf libpcap-1.0.0.tar.gz  
  2. $cd libpcap-1.0.0.tar.gz  
  3. $./configure  
  4. $make  
  5. $sudo make install  

 

----------------------------------------------------------------------------------------------------------------------------------------------------

采用上面的方法后再回到文章前面的步骤:

$cd wireshark-1.2.2编译安装:

$./configure

$make
$sudo make install

 

这样就安装好了。

启动方法:进入wireshark-1.2.2,输入命令:

[c-sharp] view plaincopy
 
  1. $sudo ./wireshark  

这里如果不用sudo,则wireshark找不到网络设备接口,这主要与权限有关,启动时注意下就行。

 

使用如下命令,可以得到Ethereal或Wireshark的详细依赖关系列表。

#apt-cache depends wireshark#apt-cache depends etherea

 

#wireshark

 

 

#ethereal

0 0
原创粉丝点击