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
备用地址:https://soft.itbulu.com/os/Centos-7.repo
如果没有安装wget,我们需要先yum install wget -y 安装。
163源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
备用地址:https://soft.itbulu.com/os/CentOS7-Base-163.repo
3、清空和拉取
yum clean all
yum makecache
这里我们更新缓存,然后最后 yum update -y