- 下载安装wget
yum install -y wget
- 备份默认的yum
mv /etc/yum.repos.d /etc/yum.repos.d.backup
- 设置新的yum目录
mkdir -p /etc/yum.repos.d
- 下载阿里yum配置到该目录中,选择对应版本
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 更新epel源为阿里云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
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
- 重建缓存
yum clean all
yum makecache
- 看一下yum仓库有多少包
yum repolist
yum update