备份yum源文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载repo文件
网易源:http://mirrors.163.com/.help/CentOS7-Base-163.repo
阿里源:http://mirrors.aliyun.com/repo/Centos-7.repo
下载任意一个repo文件(下面以网易源为例),并将其放入/etc/yum.repos.d/
目录中,命名为CentOS-Base.repo
:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
生成缓存
yum clean all
yum makecache