1. 备份
# 如有配置其他epel源
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
2. 下载新repo
下载epel到/etc/yum.repos.d/。
- 安装 epel 配置包。
```bash
RHEL 8
yum install -y https://mirrors.cloud.tencent.com/epel/epel-release-latest-8.noarch.rpm
RHEL 7
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo
RHEL 6
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-6.repo
RHEL 5
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-5.repo
2. 将 repo 配置中的地址替换为阿里云镜像站地址。
```bash
sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.cloud.tencent.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
3. 更新缓存
yum clean all
yum makecache