您的位置:首页 > 运维架构 > Linux

linux几个工具的安装

2015-10-20 14:34 866 查看
centos6.5上的安装

1、sendip

1)下载地址:http://www.earth.li/projectpurple/progs/sendip.html

wget http://www.earth.li/projectpurple/files/sendip-2.5.tar.gz
解压make后会出现如下问题

make

gcc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o csum.o csum.c

gcc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o compact.o compact.c

gcc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o sendip.o sendip.c

gcc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o gnugetopt.o gnugetopt.c

gcc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o gnugetopt1.o gnugetopt1.c

sh -c "if [ `uname` = Linux ] ; then \

gcc -o sendip -g  -rdynamic -ldl -lm -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" sendip.o gnugetopt.o gnugetopt1.o compact.o ;
\

elif [ `uname` = SunOS ] ; then \

gcc -o sendip -g -lsocket -lnsl -lm -ldl -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" sendip.o gnugetopt.o gnugetopt1.o compact.o
;\

else \

gcc -o sendip -g -rdynamic -lm -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" sendip.o gnugetopt.o gnugetopt1.o compact.o ; \

fi"

gcc -o ipv4.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared ipv4.c csum.o compact.o

cc1: warnings being treated as errors

ipv4.c: 在函数‘do_opt’中:

ipv4.c:212: 错误:传递‘sprintf’的参数 1 给指针时,目标与指针符号不一致

/usr/include/stdio.h:363: 附注:需要类型‘char * __restrict__’,但实参的类型为‘u_int8_t *’

ipv4.c:213: 错误:传递‘compact_string’的参数 1 给指针时,目标与指针符号不一致

sendip_module.h:41: 附注:需要类型‘char *’,但实参的类型为‘u_int8_t *’

ipv4.c:240: 错误:传递‘addoption’的参数 5 给指针时,目标与指针符号不一致

ipv4.c:81: 附注:需要类型‘u_int8_t *’,但实参的类型为‘char *’

ipv4.c:355: 错误:传递‘addoption’的参数 5 给指针时,目标与指针符号不一致

ipv4.c:81: 附注:需要类型‘u_int8_t *’,但实参的类型为‘char *’

ipv4.c:380: 错误:传递‘addoption’的参数 5 给指针时,目标与指针符号不一致

ipv4.c:81: 附注:需要类型‘u_int8_t *’,但实参的类型为‘char *’

ipv4.c:402: 错误:传递‘addoption’的参数 5 给指针时,目标与指针符号不一致

ipv4.c:81: 附注:需要类型‘u_int8_t *’,但实参的类型为‘char *’

make: *** [ipv4.so] 错误 1

应该打开文件按照提示进行修改就可以;

2)之后从csdn再下载一个软件进行安装:

能够进行安装了。

2、tcpreplay

先安装bison、flex、再安装libpcap等,最后再安装tcpreplay


1)./configure检查系统配置时(自动生产makefile文件)提示如下,所以需要安装libpcap文件

checking for libpcap... no

configure: error: libpcap not found

直接用yum的方法安装之后还是提示libpcap not found

然后手动安装libpcap安装包,依赖bison、flex,使用yum后再次./configure安装libpcap又报错一下命令

configure: error: Unable to link libpcap in /usr/local

又找了一下资料,试着安装了一下这个 yum install libnl-devel,之后再./configure

##########################################################################

             TCPREPLAY Suite Configuration Results (3.4.3)

##########################################################################

libpcap:                    /usr/local (>= 0.9.6)

libdnet:                    no ()

autogen:                     (unknown)

Use libopts tearoff:        yes

64bit counter support:      yes

tcpdump binary path:        /usr/sbin/tcpdump

tcpreplay edit support:     

fragroute support:          no

tcpbridge support:          yes

Supported Packet Injection Methods (*):

Linux PF_PACKET:            yes

BSD BPF:                    no

libdnet:                    no

pcap_inject:                yes

pcap_sendpacket:            yes **

* In order of preference; see configure --help to override

** Required for tcpbridge

再分别执行make make install就可以安装

3、Hping

wget http://www.hping.org/hping3-20051105.tar.gz


tar -zxvf hping3-20051105.tar.gz

cd hping3-20051105

./configure

make
make出现问题:libpcap_stuff.c:20:21: 错误:net/bpf.h:没有那个文件或目录

解决办法:

查看一下是否安装了libpcap及libpcap-devel

rpm -qa| grep libpcap

libpcap-1.0.0-6.20091201git117cb5.el6.x86_64

libpcap-devel-1.0.0-6.20091201git117cb5.el6.x86_64

/usr/bin/ld: cannot find -ltcl
collect2: ld 返回 1
make: *** [hping3] 错误 1


make

出现问题:/usr/bin/ld: cannot find -ltcl

解决方法:yum -y install tcl           yum -y install tcl-devel

再次make出现问题:这个在hping官网上有记录此bug,需要make uninstall删除,然后重新 ./configure、make、make install。

Hping3s compile error: ../hping3s/main.c:186: undefined reference to 'hping_script'

网址:http://wiki.hping.org/20

然后继续,又出现 下面 的问题,这个应该是之前 按照其他人的方法做了一个ln的链接导致的,

chmod 755 /usr/sbin/hping3

ln -s /usr/sbin/hping3 /usr/sbin/hping

ln: 创建符号链接 "/usr/sbin/hping": 文件已存在

于是使用 rm -rf  /usr/sbin/hping 删除符号链接

然后再次make install

[root@E1 hping3-20051105]# make install

cp -f hping3 /usr/sbin/

chmod 755 /usr/sbin/hping3

ln -s /usr/sbin/hping3 /usr/sbin/hping

ln -s /usr/sbin/hping3 /usr/sbin/hping2

@@@@@@ WARNING @@@@@@

Can't install the man page: /usr/local/man/man8 does not exist

最后这个应该算是安装成功了

4、fragroute

在Linux系统安装,fragroute需要三个库:libpcap、libdnet和libevent。

我的centos里面用rpm -q查找是有libpcap和libevent,所以就直接解压缩fragroute-1.2.tar.gz,但执行./configure时开始报出缺少libevent的错误,rpm明明显示已经安装,于是又手动安装一遍,再进行./configure,此时提示缺少libdnet,还是乖乖安装。

使用yum install libdnet,提示No package libdnet available.

直接下载安装包安装吧:wget http://prdownloads.sourceforge.net/libdnet/libdnet-1.11.tar.gz?download
检查环境时又遇到错误:

checking how to run the C++ preprocessor... /lib/cpp

configure: error: C++ preprocessor "/lib/cpp" fails sanity check

# yum install glibc-headers

# yum install gcc-c++

终于可以安装libdnet;
然后进行fragroute安装,安装成功。

可是执行fragroute命令时,又出现如下问题,动态链接库的问题:

查找解决方法,有以下三种方法

总结下来主要有3种方法:http://www.cnblogs.com/smartvessel/archive/2011/01/21/1940868.html

1. 用ln将需要的so文件链接到/usr/lib或者/lib这两个默认的目录下边

ln -s /where/you/install/lib/*.so /usr/lib

sudo ldconfig

2.修改LD_LIBRARY_PATH

export LD_LIBRARY_PATH=/where/you/install/lib:$LD_LIBRARY_PATH

sudo ldconfig

3.修改/etc/ld.so.conf,然后刷新

vim /etc/ld.so.conf

add /where/you/install/lib

sudo ldconfig

于是尝试使用第一种方法:
 ln -s /安装目录/libevent-1.2.so.1 /usr/lib

然后执行 ldconfig

之后执行 fragroute命令,ok!

5、isic

安装总体思路为./configure检测编译环境,通过该过程可以看出是否缺少编译程序的库,可根据提示先安装相应的依赖库;然后通过make命令进行编译

,如果库全部安装完,但该过程最后仍出现..error的话,那一般是兼容性问题了,建议另找版本,最后再通过make install 命令安装

isic版本:0.07,下载连接http://www.sfr-fresh.com/unix/privat/isic-0.07.tgz/

依赖库libnet(版本1.1.5) 下载连接http://sourceforge.net/projects/libnet-dev/  或者  http://sourceforge.net/projects/libnet-
dev/files/libnet-1.1.5.tar.gz/download

1.libnet安装

         tar -zxvf  libnet-1.1.5.tar.gz

         cd libnet-1.1.5             

          ./configure

           make

           make install

 2.isic安装

      gentoo linux下需要修改源码包里isic.h头文件,否则编译将会出错,主要原因是缺少头文件(可自己试验一下)

     在isic.h头文件中加入    #include <netinet/tcp.h>

                                      #include <netinet/udp.h>

                             (还有可能需要加入#include <netinet/ip.h)

直接执行
923b
./configure   

              make

                make install

如果安装执行命令时出现在...目录找不到libdnet.so之类的话,是表示找不到相应目录中的函数库(.so文件表示动态函式库)将/usr/local/lib/目录

下所有关于libdnet.so相关的文件都拷贝到/usr/lib/目 录下即可解决!

例如我这里显示的是isic: error while loading shared libraries: libnet.so.1: cannot open shared object file: No such file or directory

之后执行操作: cp /usr/local/lib/libnet.so.1 /usr/lib,问题解决。

但是有一个问题:安装完毕之后tcpsic/udpsic持续发包(只设置源IP\目的IP发包会产生段错误),可能是虚拟机内存设置问题?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: