1. 前言
之前整理过《好好学Linux:Ubuntu/Debian更换软件安装源》,Ubuntu/Debian中更换国内软件安装源,可以加快软件的安装速度。
同样的,在CentOS中更换国内软件安装源,也能加快软件安装速度。
2. 备用国内源
其他软件源参考《开源镜像站》
3. CentOS7更换软件安装源(已废弃)
1、备份原安装源
1 | cp /etc/yum.repos.d/CentOS-Base.repo{,.bak} |
2、下载国内的安装源
1 | wget http://mirrors.aliyun.com/repo/Centos-7.repo |
3、更新软件安装源
1 | yum clean all |
yum makecache
可能会报错:
1 | Could not resolve host: mirrorlist.centos.org; Unknown error |
解决办法:
1 | curl -fsSL https://autoinstall.plesk.com/PSA_18.0.62/examiners/repository_check.sh | bash -s -- update >/dev/null |
参考文档:Plesk or system updates fail on CentOS 7: Could not resolve host: mirrorlist.centos.org
4. CentOS7更新软件安装源(推荐)
1 | sed -i.bak \ |
5. CentOS8更换软件安装源
CentOS8已于2021年12月31日停止维护,在2022年1月31日,CentOS团队终于从官方镜像中移除CentOS8的所有包。
如果仍然需要运行CentOS8,我们可以在 /etc/yum.repos.d 中更新安装源为阿里云的镜像源。
1、备份原安装源
1 | cp -r /etc/yum.repos.d{,.bak} |
2、替换安装源
1 | rm /etc/yum.repos.d/*.repo -rf |
3、更新软件安装源
1 | yum clean all |