设为首页 收藏本站
查看: 535|回复: 0

[经验分享] centos7 安装iftop

[复制链接]
YunVN网友  发表于 2019-2-17 07:34:27 |阅读模式
  [root@mantisbt01 ~]# yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package 14:libpcap-1.5.3-9.el7.x86_64 already installed and latest version
Package ncurses-5.9-14.20130511.el7_4.x86_64 already installed and latest version
Package ncurses-devel-5.9-14.20130511.el7_4.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package byacc.x86_64 0:1.9.20130304-3.el7 will be installed
---> Package flex.x86_64 0:2.5.37-3.el7 will be installed
---> Package libpcap-devel.x86_64 14:1.5.3-9.el7 will be installed
--> Finished Dependency Resolution
  Dependencies Resolved
========================================================================================
Package                Arch            Version                     Repository     Size

  Installing:
byacc                  x86_64          1.9.20130304-3.el7          base           65 k
flex                   x86_64          2.5.37-3.el7                base          292 k
libpcap-devel          x86_64          14:1.5.3-9.el7              base          117 k
Transaction Summary
  Install  3 Packages
Total download size: 474 k
Installed size: 1.0 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): byacc-1.9.20130304-3.el7.x86_64.rpm                       |  65 kB  00:00:01
(2/3): flex-2.5.37-3.el7.x86_64.rpm                              | 292 kB  00:00:01
(3/3): libpcap-devel-1.5.3-9.el7.x86_64.rpm                      | 117 kB  00:00:00

  Total                                                      187 kB/s | 474 kB  00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : flex-2.5.37-3.el7.x86_64                                             1/3
Installing : 14:libpcap-devel-1.5.3-9.el7.x86_64                                  2/3
Installing : byacc-1.9.20130304-3.el7.x86_64                                      3/3
Verifying  : byacc-1.9.20130304-3.el7.x86_64                                      1/3
Verifying  : 14:libpcap-devel-1.5.3-9.el7.x86_64                                  2/3
Verifying  : flex-2.5.37-3.el7.x86_64                                             3/3
  Installed:
byacc.x86_64 0:1.9.20130304-3.el7               flex.x86_64 0:2.5.37-3.el7
libpcap-devel.x86_64 14:1.5.3-9.el7
  Complete!
[root@mantisbt01 ~]#
[root@mantisbt01 ~]#
[root@mantisbt01 ~]# ls
anaconda-ks.cfg  CentOS7-Base-163.repo  learning.py  python  software
[root@mantisbt01 ~]# cd software/
[root@mantisbt01 software]# wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
--2018-04-04 15:17:12--  http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
Resolving www.ex-parrot.com (www.ex-parrot.com)... 93.93.130.166, 2a00:1098:0:82:1000:0:1:2
Connecting to www.ex-parrot.com (www.ex-parrot.com)|93.93.130.166|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 160381 (157K) [application/gzip]
Saving to: ‘iftop-0.17.tar.gz’
  100%[==============================================>] 160,381      101KB/s   in 1.5s
  2018-04-04 15:17:15 (101 KB/s) - ‘iftop-0.17.tar.gz’ saved [160381/160381]
  [root@mantisbt01 software]# tar -xf  iftop-0.17.tar.gz
[root@mantisbt01 software]# chown -R root.root iftop-0.17
[root@mantisbt01 software]# cd iftop-0.17
[root@mantisbt01 iftop-0.17]# ./configure --help
`configure' configures this package to adapt to many kinds of systems.
  Usage: ./configure [OPTION]... [VAR=VALUE]...
  To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.
  Defaults for the options are specified in brackets.
  Configuration:
-h, --help              display this help and exit
--help=short        display options specific to this package
--help=recursive    display the short help of all the included packages
-V, --version           display version information and exit
-q, --quiet, --silent   do not print checking...' messages--cache-file=FILE   cache test results in FILE [disabled]-C, --config-cache      alias for--cache-file=config.cache'
-n, --no-create         do not create output files
--srcdir=DIR        find the sources in DIR [configure dir or `..']
  Installation directories:
--prefix=PREFIX         install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
[PREFIX]
  By default, make install' will install all the files in/usr/local/bin', /usr/local/lib' etc.  You can specifyan installation prefix other than/usr/local' using --prefix',for instance--prefix=$HOME'.
  For better control, use the options below.
  Fine tuning of the installation directories:
--bindir=DIR           user executables [EPREFIX/bin]
--sbindir=DIR          system admin executables [EPREFIX/sbin]
--libexecdir=DIR       program executables [EPREFIX/libexec]
--datadir=DIR          read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR    modifiable single-machine data [PREFIX/var]
--libdir=DIR           object code libraries [EPREFIX/lib]
--includedir=DIR       C header files [PREFIX/include]
--oldincludedir=DIR    C header files for non-gcc [/usr/include]
--infodir=DIR          info documentation [PREFIX/info]
--mandir=DIR           man documentation [PREFIX/man]
  Program names:
--program-prefix=PREFIX            prepend PREFIX to installed program names
--program-suffix=SUFFIX            append SUFFIX to installed program names
--program-transform-name=PROGRAM   run sed PROGRAM on installed program names
  System types:
--build=BUILD     configure for building on BUILD [guessed]
--host=HOST       cross-compile to build programs to run on HOST [BUILD]
--target=TARGET   configure for building compilers for TARGET [HOST]
  Optional Features:
--disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
--disable-dependency-tracking Speeds up one-time builds
--enable-dependency-tracking  Do not reject slow dependency extractors
--enable-default-promiscuous If enabled, iftop will operate in promiscuous mode
to capture outgoing packets
  Optional Packages:
--with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
--without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
--with-resolver=TYPE    Technique iftop should use for name resolution.
Valid options are:
netdb          use gethostbyaddr_r in multiple
threads.
netdb_1thread  use gethostbyaddr_r and
assume it is not reentrant.
ares           use the MIT ARES asynchronous
resolver library.
forking        use the REALLY SUCKY forking resolver.
guess          run experiments to guess a
reasonable value.  Only works if you
aren't cross-compiling.  This
is the default.  guess will
either select netdb or netdb_1thread.
none           don't do name resolution.
--with-libpcap=WHERE    Where the libpcap packet-capture library is found.
The pcap library should be installed  in WHERE/lib,
and the header file in either WHERE/include or
WHERE/include/pcap.
default=look in standard locations
  Some influential environment variables:
CC          C compiler command
CFLAGS      C compiler flags
LDFLAGS     linker flags, e.g. -L if you have libraries in a
nonstandard directory
CPPFLAGS    C/C++ preprocessor flags, e.g. -I if you have
headers in a nonstandard directory
CPP         C preprocessor
  Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
  [root@mantisbt01 iftop-0.17]# ./configure --prefix=/opt/iftop --bindir=/usr/bin/^C
[root@mantisbt01 iftop-0.17]# ls -ltr /usr/bin/ | head
total 547436
-rwxr-xr-x  1 root root      86504 Jun 10  2014 yacc
-rwxr-xr-x. 1 root root      11004 Jun 10  2014 pod2text
-rwxr-xr-x. 1 root root      13581 Jun 10  2014 pod2man
-rwxr-xr-x. 1 root root        271 Jun 10  2014 neqn
-rwxr-xr-x. 1 root root       3392 Jun 10  2014 nroff
-rwxr-xr-x. 1 root root     525272 Jun 10  2014 troff
-rwxr-xr-x. 1 root root     118744 Jun 10  2014 tbl
-rwxr-xr-x. 1 root root      33368 Jun 10  2014 soelim
-rwxr-xr-x. 1 root root      88312 Jun 10  2014 pre-grohtml
[root@mantisbt01 iftop-0.17]# ./configure --prefix=/opt/iftop --bindir=/usr/bin/
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking sys/dlpi.h usability... no
checking sys/dlpi.h presence... no
checking for sys/dlpi.h... no
checking for regcomp... yes
checking for select... yes
checking for strdup... yes
checking for strerror... yes
checking for strspn... yes
checking for library containing socket... none required
checking for library containing log... -lm
checking for gethostbyname... yes
checking for library containing inet_aton... none required
checking for library containing inet_pton... none required
checking for inet_aton... yes
checking for inet_pton... yes
checking size of u_int8_t... 1
checking size of u_int16_t... 2
checking size of u_int32_t... 4
checking for library containing getnameinfo... none required
checking for library containing gethostbyaddr_r... none required
checking how to call gethostbyaddr_r... 8 args, int return
checking gethostbyaddr_r usability... yes
checking where to find pcap.h... /include
checking for pcap_open_live in -lpcap... yes
checking pcap.h usability... yes
checking pcap.h presence... yes
checking for pcap.h... yes
checking for a curses library containing mvchgat... -lcurses
checking POSIX threads compilation... CFLAGS= and LIBS=-lpthread
checking POSIX threads usability... yes
checking if we need to enable promiscuous mode by default... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating config.h
config.status: executing depfiles commands
[root@mantisbt01 iftop-0.17]#
  [root@mantisbt01 iftop-0.17]# echo $?
0
[root@mantisbt01 iftop-0.17]# make
make  all-recursive
make[1]: Entering directory /root/software/iftop-0.17'Making all in configmake[2]: Entering directory/root/software/iftop-0.17/config'
make[2]: Nothing to be done for all'.make[2]: Leaving directory/root/software/iftop-0.17/config'
make[2]: Entering directory /root/software/iftop-0.17'source='addr_hash.c' object='addr_hash.o' libtool=no \depfile='.deps/addr_hash.Po' tmpdepfile='.deps/addr_hash.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'addr_hash.c' || echo './'addr_hash.csource='edline.c' object='edline.o' libtool=no \depfile='.deps/edline.Po' tmpdepfile='.deps/edline.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'edline.c' || echo './'edline.csource='hash.c' object='hash.o' libtool=no \depfile='.deps/hash.Po' tmpdepfile='.deps/hash.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'hash.c' || echo './'hash.csource='iftop.c' object='iftop.o' libtool=no \depfile='.deps/iftop.Po' tmpdepfile='.deps/iftop.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'iftop.c' || echo './'iftop.csource='ns_hash.c' object='ns_hash.o' libtool=no \depfile='.deps/ns_hash.Po' tmpdepfile='.deps/ns_hash.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'ns_hash.c' || echo './'ns_hash.csource='options.c' object='options.o' libtool=no \depfile='.deps/options.Po' tmpdepfile='.deps/options.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'options.c' || echo './'options.csource='resolver.c' object='resolver.o' libtool=no \depfile='.deps/resolver.Po' tmpdepfile='.deps/resolver.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'resolver.c' || echo './'resolver.csource='screenfilter.c' object='screenfilter.o' libtool=no \depfile='.deps/screenfilter.Po' tmpdepfile='.deps/screenfilter.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'screenfilter.c' || echo './'screenfilter.csource='serv_hash.c' object='serv_hash.o' libtool=no \depfile='.deps/serv_hash.Po' tmpdepfile='.deps/serv_hash.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'serv_hash.c' || echo './'serv_hash.csource='sorted_list.c' object='sorted_list.o' libtool=no \depfile='.deps/sorted_list.Po' tmpdepfile='.deps/sorted_list.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'sorted_list.c' || echo './'sorted_list.csource='threadprof.c' object='threadprof.o' libtool=no \depfile='.deps/threadprof.Po' tmpdepfile='.deps/threadprof.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'threadprof.c' || echo './'threadprof.csource='ui.c' object='ui.o' libtool=no \depfile='.deps/ui.Po' tmpdepfile='.deps/ui.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'ui.c' || echo './'ui.csource='util.c' object='util.o' libtool=no \depfile='.deps/util.Po' tmpdepfile='.deps/util.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'util.c' || echo './'util.csource='addrs_ioctl.c' object='addrs_ioctl.o' libtool=no \depfile='.deps/addrs_ioctl.Po' tmpdepfile='.deps/addrs_ioctl.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'addrs_ioctl.c' || echo './'addrs_ioctl.csource='addrs_dlpi.c' object='addrs_dlpi.o' libtool=no \depfile='.deps/addrs_dlpi.Po' tmpdepfile='.deps/addrs_dlpi.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'addrs_dlpi.c' || echo './'addrs_dlpi.csource='dlcommon.c' object='dlcommon.o' libtool=no \depfile='.deps/dlcommon.Po' tmpdepfile='.deps/dlcommon.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'dlcommon.c' || echo './'dlcommon.csource='stringmap.c' object='stringmap.o' libtool=no \depfile='.deps/stringmap.Po' tmpdepfile='.deps/stringmap.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'stringmap.c' || echo './'stringmap.csource='cfgfile.c' object='cfgfile.o' libtool=no \depfile='.deps/cfgfile.Po' tmpdepfile='.deps/cfgfile.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'cfgfile.c' || echo './'cfgfile.csource='vector.c' object='vector.o' libtool=no \depfile='.deps/vector.Po' tmpdepfile='.deps/vector.TPo' \depmode=gcc3 /bin/sh ./config/depcomp \gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2  -ctest -f 'vector.c' || echo './'vector.cgcc  -g -O2    -o iftop  addr_hash.o edline.o hash.o iftop.o ns_hash.o options.o resolver.o screenfilter.o serv_hash.o sorted_list.o threadprof.o ui.o util.o addrs_ioctl.o addrs_dlpi.o dlcommon.o stringmap.o cfgfile.o vector.o  -lpcap -lm  -lcurses -lpthreadmake[2]: Leaving directory/root/software/iftop-0.17'
make[1]: Leaving directory /root/software/iftop-0.17'[root@mantisbt01 iftop-0.17]# make installMaking install in configmake[1]: Entering directory/root/software/iftop-0.17/config'
make[2]: Entering directory /root/software/iftop-0.17/config'make[2]: Nothing to be done forinstall-exec-am'.
make[2]: Nothing to be done for install-data-am'.make[2]: Leaving directory/root/software/iftop-0.17/config'
make[1]: Leaving directory /root/software/iftop-0.17/config'make[1]: Entering directory/root/software/iftop-0.17'
make[2]: Entering directory /root/software/iftop-0.17'/bin/sh ./config/mkinstalldirs /opt/iftop/sbinmkdir -p -- /opt/iftop/sbin/usr/bin/install -c iftop /opt/iftop/sbin/iftop/bin/sh ./config/mkinstalldirs /opt/iftop/man/man8mkdir -p -- /opt/iftop/man/man8/usr/bin/install -c -m 644 ./iftop.8 /opt/iftop/man/man8/iftop.8make[2]: Leaving directory/root/software/iftop-0.17'
make[1]: Leaving directory `/root/software/iftop-0.17'
[root@mantisbt01 iftop-0.17]#
  [root@mantisbt01 iftop-0.17]# which iftop
/usr/bin/which: no iftop in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/python3/bin:/root/bin)
  [root@mantisbt01 iftop-0.17]# ln -s /opt/iftop/sbin/iftop /usr/bin/iftop
[root@mantisbt01 iftop-0.17]# which iftop
/usr/bin/iftop
[root@mantisbt01 iftop-0.17]#
[root@mantisbt01 iftop-0.17]#
[root@mantisbt01 iftop-0.17]# iftop
interface: ens33
IP address is: 192.168.2.180
MAC address is: 00:0c:29:cc:cf:6f
[root@mantisbt01 iftop-0.17]#




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-673349-1-1.html 上篇帖子: Centos 7 Root 密码破解 下篇帖子: centos7.4安装 DNS 服务器
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表