1. Preparatory work
#导入gpg key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
#在/etc/yum.repos.d/下安装elrepo.repo 文件
yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
2. If vim is not installed, you can install it first.
sudo yum install vim
3. Edit the /etc/yum.repos.d/elrepo.repo file
vim /etc/yum.repos.d/elrepo.repo
Add # in front of the line starting with mirrorlist= to comment it out; and replace elrepo.org/linux with mirrors.tuna.tsinghua.edu.cn/elrepo.
You can open this link:
Tsinghua University Open Source Software Mirror Station
4. Update package cache
yum makecache
5. Create a new epel.repo file
touch /etc/yum.repos.d/epel.repo
vim /etc/yum.repos.d/epel.repo
Edit the file /etc/yum.repos.d/epel.repo with the following content:
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/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
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
6. Finally, yum makecache
yum makecache
reference
EPEL noun explanation
EPEL (Extra Packages for Enterprise Linux) is a package frequently used in Enterprise Linux (RHEL, CentOS) maintained by the Fedora Special Interest Group.
illustrate
Interested friends can also give it a try and use epel provided by Ali
http://mirrors.aliyun.com/repo/epel-6.repo
http://mirrors.aliyun.com/repo/epel-7.repo