1. 裸机没装GCC
离线安装
首先到http://vault.centos.org/6.5/os/x86_64/Packages/下载用到的rpm包,包括:ppl-0.10.2-11.el6.x86_64.rpm 、cloog-ppl-0.15.7-1.2.el6.x86_64.rpm 、mpfr-2.4.1-6.el6.x86_64.rpm 、cpp-4.4.6-4.el6.x86_64.rpm 、kernel-headers-2.6.32-279.el6.x86_64.rpm 、glibc-headers-2.12-1.80.el6.x86_64.rpm 、glibc-devel-2.12-1.80.el6.x86_64.rpm 、libstdc++-devel-4.4.6-4.el6.x86_64.rpm 、gcc-4.4.6-4.el6.x86_64.rpm 、gcc-c++-4.4.6-4.el6.x86_64.rpm
安装
rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm
rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
rpm -ivh cpp-4.4.7-4.el6.x86_64.rpm
rpm -ivh kernel-headers-2.6.32-431.el6.x86_64.rpm
rpm -ivh glibc-headers-2.12-1.132.el6.x86_64.rpm
rpm -ivh glibc-devel-2.12-1.132.el6.x86_64.rpm
rpm -ivh gcc-4.4.7-4.el6.x86_64.rpm
rpm -ivh libstdc++-devel-4.4.7-4.el6.x86_64.rpm
rpm -ivh gcc-c++-4.4.7-4.el6.x86_64.rpm
一定要按顺序进行安装
部分安装提示already installed,没关系,
如遇Error 在安装时后面加:加上参数 --nodeps --force
rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm --nodeps --force
rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm --nodeps --force
rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm --nodeps --force
rpm -ivh cpp-4.4.7-4.el6.x86_64.rpm --nodeps --force
rpm -ivh kernel-headers-2.6.32-431.el6.x86_64.rpm --nodeps --force
rpm -ivh glibc-headers-2.12-1.132.el6.x86_64.rpm --nodeps --force
rpm -ivh glibc-devel-2.12-1.132.el6.x86_64.rpm --nodeps --force
rpm -ivh gcc-4.4.7-4.el6.x86_64.rpm --nodeps --force
rpm -ivh libstdc++-devel-4.4.7-4.el6.x86_64.rpm --nodeps --force
rpm -ivh gcc-c++-4.4.7-4.el6.x86_64.rpm --nodeps --force
执行完,gcc就安装成功了
csdn上有已经整理好的包文件,https://download.csdn.net/download/u010786396/10146583
LinuxCentOS6.5离线安装gcc包。安装方法下载gcc.zip文件上传服务器解压后进入gcc目录执行./install-gcc.sh命令。执行查看gcc版本命令:gcc -v ;执行查看g++版本命令:g++ -v
2. 装tcpdump以及关联包
安装步骤:
(1) tcpdump需要依赖包libcap,所以需要先安装lipcap,然后安装tcpdump
(2) lipcap需要依赖包flex和bison,所以需要先安装flex和bison
(3) flex、bison、libcap、tcpdump百度网盘安装包可以访问链接: https://pan.baidu.com/s/17Kx56e_B87OnOSQz598D5w
提取码:jsw8
如果想下载最新版本tar.gz格式的libcap、tcpdump,可以访问链接: https://www.tcpdump.org/release/
如果想下载不同操作系统的rpm格式的 flex、bison、libcap、tcpdump,可以访问链接: https://pkgs.org/download/libpcap
1.安装依赖包flex和bison
安装包:
tar -zxvf flex.tar.gz
cd flex/
./configure --prefix=/usr
make && sudo make install
tar -zxvf bison.tar.gz
cd bison/
./configure --prefix=/usr
make && sudo make install
安装bison:make编辑报错./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
解决办法:
vi lib/stdio.in.h
查找字段:gets is a security hole,将_GL_WARN_ON_USE (gets, “gets is a security hole - use fgets instead”); 字段和他之前的注释 /* 一块注释掉,如下
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89.
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); */
再添加如下内容:
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
安装bison:make编辑报错lib/fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib
解决办法:
cd /opt/p2/openwrt/build_dir/host/bison-3.0.4/
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
2.安装lipcap
tar -zxvf libpcap-1.5.3.tar.gz
cd libpcap-1.5.3
./configure
sudo make install
3.安装tcpdump
tar -zxvf tcpdump-4.5.1.tar.gz
cd tcpdump-4.5.1
./configure
sudo make install
4.校验安装成功
抓取所有经过eno33559296网卡的网络数据,并写入指定文件
tcpdump -i eth0 -w /tmp/111.pcap