一、备份YUM源

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo-backup

二、下载YUM源

wget下载与curl下载选择一个就可以

阿里

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

华为

wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-anon.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-anon.repo

网易

wget -P /etc/yum.repos.d http://mirrors.163.com/.help/CentOS7-Base-163.repo
curl -o /etc/yum.repos.d http://mirrors.163.com/.help/CentOS7-Base-163.repo

三、更换epel源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

四、清理更新缓存

yum clean all && yum makecache
如果觉得我的文章对你有用,请随意赞赏