说明:
提示:提示:这篇文章仅是记录自己成长路上的愚笨,不喜勿喷,同时也希望各路大神提出优秀的观点。谢谢!!
问题描述:
:今天生产上出现了阿里云ECS服务器内网流出带宽占用过高的问题。经过网上查询阿里官网给出了一篇博客,如下:
里面介绍的是让安装nethogs
工具,找出哪个应用占用带宽高,但是在ECS服务器上安装nethogs
软件时,却报错epel源不可用!
题外:
epel源:官网是这样介绍的
Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).
大意是:
EPEL (Extra Packages for Enterprise Linux,企业版Linux的额外软件包) 是Fedora小组维护的一个软件仓库项目,为RHEL/CentOS提供他们默认不提供的软件包。这个源兼容RHEL及像CentOS和Scientific Linux这样的衍生版本。
网上也找了好多教程,基本都是以失败告终。无奈找到epel官网,按照官网的教程来安装,本以为按照官网可以成功,但是,我以为的以为,还是失败了!
注意:在自己安装的centos7中按照官网的教程是能成功的,但是阿里云ECS服务器不可以!
无奈只能查找阿里云ECS服务器配置了!!
进入源目录
cd /etc/yum.repos.d
ll
查看列表
在安装之前只有2018年的那几个文件
打开epel.repo
vim epel.repo
1 [epel]
2 name=Extra Packages for Enterprise Linux 6 - $basearch
3 baseurl=http://mirrors.cloud.aliyuncs.com/epel/6/$basearch
4 http://mirrors.aliyun.com/epel/6/$basearch
5 failovermethod=priority
6 enabled=1
7 gpgcheck=0
8 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
9
10 [epel-debuginfo]
11 name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
12 baseurl=http://mirrors.cloud.aliyuncs.com/epel/6/$basearch/debug
13 http://mirrors.aliyun.com/epel/6/$basearch/debug
14 failovermethod=priority
15 enabled=0
16 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
17 gpgcheck=0
18
19 [epel-source]
20 name=Extra Packages for Enterprise Linux 6 - $basearch - Source
21 baseurl=http://mirrors.cloud.aliyuncs.com/epel/6/SRPMS
22 http://mirrors.aliyun.com/epel/6/SRPMS
23 failovermethod=priority
24 enabled=0
25 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
26 gpgcheck=0
在这篇配置中有个baseurl,点进去发现这个仓库中已经没有rpm文件了,里面有个README文件,打开这个文件
ATTENTION
======================================
The contents of this directory have been moved to our archives available at:
http://archives.fedoraproject.org/pub/archive/epel/
If you are having troubles finding something there please stop by #epel on irc.freenode.net
意思就是,注意:这个目录下的文件已经被移动到http://archives.fedoraproject.org/pub/archive/epel/这个地址下了。
SO,问题找到了!!
解决方案:
- 确认阿里云ECS服务器Linux版本
以下所有命令均在root环境下操作的
cat /etc/redhat-release
- 下载epel的rpm安装包
一定要注意版本,要下载CentOS 6版本所对应的epel 的版本(目前这个地址肯定可用)
wget http://archives.fedoraproject.org/pub/archive/epel/6/i386/epel-release-6-8.noarch.rpm
- 安装epel
rpm -ivh epel-release-6-8.noarch.rpm
- 替换
epel.repo
文件(这一步很重要,如果不替换的话,安装epel源下的程序依然会不成功!)
mv epel.repo epel.repo.bak
mv epel.repo.rpmnew epel.repo
也就是把第三步中安装rpm后产生的repo替换掉ECS服务器原带的repo!
- 验证epel源
yum repolist
Trying other mirror.
repo id repo name status
base CentOS-6 - Base 6,713
epel Extra Packages for Enterprise Linux 6 - x86_64 12,581
extras CentOS-6 - Extras 47
updates CentOS-6 - Updates 1,169
repolist: 20,510
- 安装
nethogs
yum install nethogs
经过漫长的等待,nethogs安装成功,大功告成!
安装过程没有记录截图,遗憾了。。。