1.先对默认的yum源进行更名备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载国内的阿里云yum源配置文件到/etc/yum.repos.d/【我下载阿里源】
阿里源(推荐):
wget -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 http://mirrors.163.com/.help/CentOS7-Base-163.repo
3.然后分别执行:
yum clean all # 清除系统所有的yum缓存
yum makecache # 生成yum缓存