CentOS版本:7.3

[root@localhost ifstat-1.1]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 
[root@localhost ifstat-1.1]#

下载ifstat软件包:

 wget http://gael.roualland.free.fr/ifstat/ifstat-1.1.tar.gz

解压ifstat-1.1.tar.gz

[root@localhost ~]# tar -zxvf ifstat-1.1.tar.gz

进入ifstat-1.1文件夹:

cd ifstat-1.1

检测安装环境:

[root@localhost ifstat-1.1]# ./configure 
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking for gcc... no
checking for cc... no
configure: error: no acceptable cc found in $PATH
[root@localhost ifstat-1.1]#

显示没有安装gcc和cc。

通过yum仓库安装gcc和cc:

[root@localhost ifstat-1.1]# yum -y install gcc cc

Installed:
  gcc.x86_64 0:4.8.5-11.el7                                                                                                                                                                                                                                                   

Dependency Installed:
  cpp.x86_64 0:4.8.5-11.el7                   glibc-devel.x86_64 0:2.17-157.el7_3.4                   glibc-headers.x86_64 0:2.17-157.el7_3.4                   kernel-headers.x86_64 0:3.10.0-514.21.2.el7                   libmpc.x86_64 0:1.0.1-3.el7                  

Dependency Updated:
  glibc.x86_64 0:2.17-157.el7_3.4                                                                                                    glibc-common.x86_64 0:2.17-157.el7_3.4                                                                                                   

Complete!
[root@localhost ifstat-1.1]#

重新检测安装环境:

[root@localhost ifstat-1.1]# ./configure
creating ./config.status
creating Makefile
creating config.h
[root@localhost ifstat-1.1]#

编译:

[root@localhost ifstat-1.1]#make
gcc -I. -g -O2 -DHAVE_CONFIG_H  -c ifstat.c -o ifstat.o
gcc -I. -g -O2 -DHAVE_CONFIG_H  -c drivers.c -o drivers.o
gcc -I. -g -O2 -DHAVE_CONFIG_H  -c data.c -o data.o
gcc ifstat.o drivers.o data.o   -o ifstat
[root@localhost ifstat-1.1]#

安装:

[root@localhost ifstat-1.1]#make install
/usr/bin/install -c -d -m 755 /usr/local/bin
/usr/bin/install -c -s -m 755 ifstat /usr/local/bin/ifstat
/usr/bin/install -c -d -m 755 /usr/local/man/man1
/usr/bin/install -c -m 644 ifstat.1 /usr/local/man/man1/ifstat.1
[root@localhost ifstat-1.1]#

此时ifstat安装完毕。

看看效果吧!

[root@localhost ifstat-1.1]# ifstat
      ens33               ens37               virbr0      
 KB/s in  KB/s out   KB/s in  KB/s out   KB/s in  KB/s out
    0.00      0.00      0.06      0.23      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.16      0.00      0.00
    0.00      0.00      0.06      0.16      0.00      0.00
    0.00      0.00      0.06      0.16      0.00      0.00
    0.00      0.00      0.06      0.16      0.00      0.00