1.备份原有的yum源,以防出错时还可以还原。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.进入yum.repos.d目录。
cd /etc/yum.repos.d
3.下载相应的源。(我用的是163yum源)
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo #centos7系统的
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo #centos6系统的
wget http://mirrors.163.com/.help/CentOS5-Base-163.repo #centos5系统的
(注:如果下载出现错误,可能是变更了下载的地址,可以到:http://mirrors.163.com/.help/centos.html 找新的下载地址。没有安装wget的,要先安装。)
4.将下载的源更名为默认的CentOS-Base.repo。
mv CentOS6-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo
5.产生新的缓存。
yum clean all #清空缓存
yum makecache #生成新的缓存
至此源更新完成,可以 yum -y update 测试一下更新的速度。
企业镜像
阿里巴巴开源镜像站:https://developer.aliyun.com/mirror/
腾讯开源镜像站:https://mirrors.cloud.tencent.com/
网易开源镜像站:http://mirrors.163.com/
华为开源镜像站:https://mirrors.huaweicloud.com/
搜狐开源镜像站:http://mirrors.sohu.com/
大学镜像
清华大学开源镜像站:https://mirrors.tuna.tsinghua.edu.cn/
中国科技大学开源镜像站:http://mirrors.ustc.edu.cn/
华中科技大学开源镜像站:http://mirror.hust.edu.cn/
浙江大学开源镜像站:http://mirrors.zju.edu.cn/
北京理工大学开源镜像站:http://mirror.bit.edu.cn/