CentOS
1、备份(备份本地Yum源)
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost yum.repos.d]# cat /etc/redhat-release CentOS release 6.7 (Final) [root@localhost yum.repos.d]# ls Centos-6.repo CentOS-Media.repo.bak [root@localhost yum.repos.d]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 #添加 DNS1=8.8.8.8 DNS2=8.8.4.4
3、缓存
[root@localhost yum.repos.d]# yum clean all ... #清除缓存 [root@localhost yum.repos.d]# yum makecache ... #生成新的阿里yum源缓存到本地 [root@localhost yum.repos.d]# yum list ... #列出可用包