进入到repo的存放位置
[root@centos ~]# cd /etc/yum.repos.d/
下载网易的repo
[root@centos yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@centos yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
将原来的repo备份
[root@centos yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
将网易的repo更改为默认的源
[root@centos yum.repos.d]# mv CentOS6-Base-163.repo CentOS-Base.repo
生成缓存
[root@centos yum.repos.d]# yum clean all
[root@centos yum.repos.d]# yum makecache
验证更新是否正确
[root@centos yum.repos.d]# yum repolist
显示如下图所示,代表更换成功
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30272993/viewspace-1685783/ ,如需转载,请注明出处,否则将追究法律责任。