在Ubuntu安装测试libpcap(Install the libpcap in Ubuntu 11.04)
2012-12-11 23:45
656 查看
1.Download the tar of libpcap
in site: http://www.tcpdump.org/
My File is libpcap-1.2.1.tar.gz.
2.Now, We get the folder libpcap-1.3.0
3.we need install flex
sudo apt-get install flex
if don't do this step will:
4. Configure
5.Install byacc
sudo apt-get install byacc
if not do this step will :
yacc -d grammar.y
make: yacc: Command not found
make: *** [grammar.c] Error 127
6. make
7. sudo make install
8. Test.
9 ln a link for libpcap
if don't do this step, 10th step will:
error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file or directory
10 Run it!
设备名:XXX
Congratulation for your success !
in site: http://www.tcpdump.org/
My File is libpcap-1.2.1.tar.gz.
tar -zxvf libpcap-1.3.0.tar.gz
2.Now, We get the folder libpcap-1.3.0
cd libpcap-1.3.0
3.we need install flex
sudo apt-get install flex
if don't do this step will:
4. Configure
./configure
5.Install byacc
sudo apt-get install byacc
if not do this step will :
yacc -d grammar.y
make: yacc: Command not found
make: *** [grammar.c] Error 127
6. make
7. sudo make install
8. Test.
vim testlibpcap.c
#include<stdio.h> #include<stdlib.h> #include<pcap.h> #include<errno.h> #include<sys/socket.h> #include<netinet/in.h> #include<arpa/inet.h> int main(int argc,char *argv[]) { char *dev; char errbuf[PCAP_ERRBUF_SIZE]; dev = pcap_lookupdev(errbuf); if(dev ==NULL) { printf("%s\n",errbuf); exit(1); } printf("设备名:%s\n",dev); return 0; }
gcc testlibpcap.c -o testlibpcap -lpcap -Wall
9 ln a link for libpcap
sudo ln -s /usr/lib/libpcap.1.X.X /usr/lib/libpcap.1
if don't do this step, 10th step will:
error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file or directory
10 Run it!
sudo ./testlibpcapIf it show:
设备名:XXX
Congratulation for your success !
相关文章推荐
- how to install the chrome in the Ubuntu platform
- ubuntu 安装maven提示出错 The program 'mvn' can be found in the following packages
- Ubuntu 11.04 安装 ns2-allinone-2.34【完整版】(附各种问题解决方案)
- How to install Nagios in ubuntu10.04/10.10(如何安装nagios)
- Windows7 下安装Theano (Install Theano in Windows 7)
- Fix "Unable to lock the administration directory (/var/lib/dpkg/)" in Ubuntu
- Ubuntu使用apt-get install 安装软件时报错:could not get lock /var/lib/dpkg/lock -open
- ubuntu libpcap安装流程
- How to install the pycharm in my ubuntu
- GTX1070+WIN10安装UBUNTU16双系统显示ubuntu ESRT header is not in the memory map
- How To Fix “Problem with MergeList /var/lib/apt/lists” Error In Ubuntu 11.04
- virtualbox安装ubuntu出现“The system is running in low-graphics mode”
- How to install sun-java5-jdk in Ubuntu 11.04
- 安装Python-Matplotlib时出现的问题--Python version 2.7 required, which was not found in the registry
- ubuntu 安装 Andorid Studio 错误:Unable to install Android Studio in Ubuntu
- 在Ubuntu终端中使用安装命令Sudo apt-get install xxx时时出现E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)的错误解决方案
- ubuntu 安装 Andorid Studio 错误:Unable to install Android Studio in Ubuntu
- Ubuntu 14.04下Redis安装报错:“You need tcl 8.5 or newer in order to run the Redis test”问题解决
- ubuntu libpcap安装
- Install Faience Theme and Icons in Ubuntu 12.04