CentOS系统更换软件安装源

第一步:备份你的原镜像文件,以免出错后可以恢复。


 

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

 

第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/

 

阿里云镜像源

 

CentOS 6

 

 

wget -O /etc/yum.repos.d/CentOS-6-aliyun.repo http://mirrors.aliyun.com/repo/Centos-6.repo

wget -O /etc/yum.repos.d/epel-6-aliyun.repo http://mirrors.aliyun.com/repo/epel-6.repo

 

CentOS 7
<span style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;">wget -O /etc/yum.repos.d/CentOS<span style="text-align: left; color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 14px; font-style: normal; font-weight: normal; background-color: rgb(255, 255, 255);">-7-aliyun</span>.repo<span style="background-color: inherit;">&nbsp;&nbsp;</span></span><span style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;">http://mirrors.aliyun.com/repo/Centos-7.repo</span>

wget -O /etc/yum.repos.d/epel-7-aliyun.repo http://mirrors.aliyun.com/repo/epel-7.repo

 

 

或者163镜像源

CentOS 6

wget -O /etc/yum.repos.d/CentOS6-Base-163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

 

CentOS 7


wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo


 

第三步:运行yum makecache生成缓存

yum clean all

 

yum makecache

 

中科大的Linux安装镜像源


http://centos.ustc.edu.cn/help/centos.html