centos 安装iftop 以及遇到的问题

今天想监控下vps的流量 往上找了下 都是安装iftop这个工具 然后就遇到各种问题
首先 yum install iftop
返回:

Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base/primary_db                                                                                         | 4.7 MB     01:26
extras                                                                                                  | 3.4 kB     00:00
extras/primary_db                                                                                       |  29 kB     00:00
updates                                                                                                 | 3.4 kB     00:00
updates/primary_db                                                                                      | 1.4 MB     00:01
No package iftop available.
Error: Nothing to do

无奈 换成阿里云的源 问题依旧 只好编译安装了
iftop官网
第一步 安装依赖

yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel

 
第二步 下载iftop

wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
tar zxvf iftop-0.17.tar.gz
cd iftop-0.17
./configure
make && make install

问题:
error: can't find pcap.h
You're not going to get very far without libpcap.
遇到上面两个问题 请先执行第一步 看看是否有依赖没有安装 可以尝试更换源 再执行
 
更换源的方法:
 

//备份当前的yum源
mv /etc/yum.repos.d /etc/yum.repos.d.backup4comex
//新建空的yum源设置目录
mkdir /etc/yum.repos.d
//下载阿里云的yum源配置
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo  //Centos6选这个
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo  //Centos7选这个
THE END
分享
二维码
< <上一篇
下一篇>>