转载 : http://www.blogketori.com/wordpress/2020/03/28/%E6%96%B0%E5%88%9D%E5%A7%8B%E5%8C%96%E5%88%B0centos%E5%AE%9E%E4%BE%8B%E6%97%A0%E6%B3%95%E9%80%9A%E8%BF%87yum%E5%AE%89%E8%A3%85epel-release%E7%AD%89%E5%BA%93/
有部分等centos在初始化实例完毕之后是没有配置yum源的,这个时候需要手动配置了
进入
vim /etc/yum.repos.d/epel.repo
在里面输入
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
然后切换到目录 /etc/pki/rpm-gpg/
cd /etc/pki/rpm-gpg/
执行下面这段指令
wget https://archive.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
最终yum install epel-release就可以安装啦!!!