1. 程式人生 > >centos7 安裝iftop

centos7 安裝iftop

iftop

[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<br/>--cache-file=FILE cache test results in FILE [disabled]<br/>-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<br/>/usr/local/bin‘, /usr/local/lib‘ etc. You can specify<br/>an installation prefix other than/usr/local‘ using --prefix‘,<br/>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<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
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‘<br/>Making all in config<br/>make[2]: Entering directory/root/software/iftop-0.17/config‘
make[2]: Nothing to be done for all‘.<br/>make[2]: Leaving directory/root/software/iftop-0.17/config‘
make[2]: Entering directory /root/software/iftop-0.17‘<br/>source=‘addr_hash.c‘ object=‘addr_hash.o‘ libtool=no \<br/>depfile=‘.deps/addr_hash.Po‘ tmpdepfile=‘.deps/addr_hash.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘addr_hash.c‘ || echo ‘./‘addr_hash.c<br/>source=‘edline.c‘ object=‘edline.o‘ libtool=no \<br/>depfile=‘.deps/edline.Po‘ tmpdepfile=‘.deps/edline.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘edline.c‘ || echo ‘./‘edline.c<br/>source=‘hash.c‘ object=‘hash.o‘ libtool=no \<br/>depfile=‘.deps/hash.Po‘ tmpdepfile=‘.deps/hash.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘hash.c‘ || echo ‘./‘hash.c<br/>source=‘iftop.c‘ object=‘iftop.o‘ libtool=no \<br/>depfile=‘.deps/iftop.Po‘ tmpdepfile=‘.deps/iftop.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘iftop.c‘ || echo ‘./‘iftop.c<br/>source=‘ns_hash.c‘ object=‘ns_hash.o‘ libtool=no \<br/>depfile=‘.deps/ns_hash.Po‘ tmpdepfile=‘.deps/ns_hash.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘ns_hash.c‘ || echo ‘./‘ns_hash.c<br/>source=‘options.c‘ object=‘options.o‘ libtool=no \<br/>depfile=‘.deps/options.Po‘ tmpdepfile=‘.deps/options.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘options.c‘ || echo ‘./‘options.c<br/>source=‘resolver.c‘ object=‘resolver.o‘ libtool=no \<br/>depfile=‘.deps/resolver.Po‘ tmpdepfile=‘.deps/resolver.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘resolver.c‘ || echo ‘./‘resolver.c<br/>source=‘screenfilter.c‘ object=‘screenfilter.o‘ libtool=no \<br/>depfile=‘.deps/screenfilter.Po‘ tmpdepfile=‘.deps/screenfilter.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘screenfilter.c‘ || echo ‘./‘screenfilter.c<br/>source=‘serv_hash.c‘ object=‘serv_hash.o‘ libtool=no \<br/>depfile=‘.deps/serv_hash.Po‘ tmpdepfile=‘.deps/serv_hash.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘serv_hash.c‘ || echo ‘./‘serv_hash.c<br/>source=‘sorted_list.c‘ object=‘sorted_list.o‘ libtool=no \<br/>depfile=‘.deps/sorted_list.Po‘ tmpdepfile=‘.deps/sorted_list.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘sorted_list.c‘ || echo ‘./‘sorted_list.c<br/>source=‘threadprof.c‘ object=‘threadprof.o‘ libtool=no \<br/>depfile=‘.deps/threadprof.Po‘ tmpdepfile=‘.deps/threadprof.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘threadprof.c‘ || echo ‘./‘threadprof.c<br/>source=‘ui.c‘ object=‘ui.o‘ libtool=no \<br/>depfile=‘.deps/ui.Po‘ tmpdepfile=‘.deps/ui.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘ui.c‘ || echo ‘./‘ui.c<br/>source=‘util.c‘ object=‘util.o‘ libtool=no \<br/>depfile=‘.deps/util.Po‘ tmpdepfile=‘.deps/util.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘util.c‘ || echo ‘./‘util.c<br/>source=‘addrs_ioctl.c‘ object=‘addrs_ioctl.o‘ libtool=no \<br/>depfile=‘.deps/addrs_ioctl.Po‘ tmpdepfile=‘.deps/addrs_ioctl.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘addrs_ioctl.c‘ || echo ‘./‘addrs_ioctl.c<br/>source=‘addrs_dlpi.c‘ object=‘addrs_dlpi.o‘ libtool=no \<br/>depfile=‘.deps/addrs_dlpi.Po‘ tmpdepfile=‘.deps/addrs_dlpi.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘addrs_dlpi.c‘ || echo ‘./‘addrs_dlpi.c<br/>source=‘dlcommon.c‘ object=‘dlcommon.o‘ libtool=no \<br/>depfile=‘.deps/dlcommon.Po‘ tmpdepfile=‘.deps/dlcommon.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘dlcommon.c‘ || echo ‘./‘dlcommon.c<br/>source=‘stringmap.c‘ object=‘stringmap.o‘ libtool=no \<br/>depfile=‘.deps/stringmap.Po‘ tmpdepfile=‘.deps/stringmap.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘stringmap.c‘ || echo ‘./‘stringmap.c<br/>source=‘cfgfile.c‘ object=‘cfgfile.o‘ libtool=no \<br/>depfile=‘.deps/cfgfile.Po‘ tmpdepfile=‘.deps/cfgfile.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘cfgfile.c‘ || echo ‘./‘cfgfile.c<br/>source=‘vector.c‘ object=‘vector.o‘ libtool=no \<br/>depfile=‘.deps/vector.Po‘ tmpdepfile=‘.deps/vector.TPo‘ \<br/>depmode=gcc3 /bin/sh ./config/depcomp \<br/>gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -ctest -f ‘vector.c‘ || echo ‘./‘vector.c<br/>gcc -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 -lpthread<br/>make[2]: Leaving directory/root/software/iftop-0.17‘
make[1]: Leaving directory /root/software/iftop-0.17‘<br/>[root@mantisbt01 iftop-0.17]# make install<br/>Making install in config<br/>make[1]: Entering directory/root/software/iftop-0.17/config‘
make[2]: Entering directory /root/software/iftop-0.17/config‘<br/>make[2]: Nothing to be done forinstall-exec-am‘.
make[2]: Nothing to be done for install-data-am‘.<br/>make[2]: Leaving directory/root/software/iftop-0.17/config‘
make[1]: Leaving directory /root/software/iftop-0.17/config‘<br/>make[1]: Entering directory/root/software/iftop-0.17‘
make[2]: Entering directory /root/software/iftop-0.17‘<br/>/bin/sh ./config/mkinstalldirs /opt/iftop/sbin<br/>mkdir -p -- /opt/iftop/sbin<br/>/usr/bin/install -c iftop /opt/iftop/sbin/iftop<br/>/bin/sh ./config/mkinstalldirs /opt/iftop/man/man8<br/>mkdir -p -- /opt/iftop/man/man8<br/>/usr/bin/install -c -m 644 ./iftop.8 /opt/iftop/man/man8/iftop.8<br/>make[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]#

centos7 安裝iftop