(1)备份原来的软件源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
(2)下载阿里源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
(3)生成缓存
yum makecache
(4)清除不必要的提示信息
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
(5)更新软件源
yum update -y
第二步如果提示没有wget,就先执行yum install wget -y
然后再继续操作就行
来源地址:https://blog.csdn.net/qq_17533907/article/details/128755014