备份原镜像
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载阿里云镜像
下载新的 CentOS-8.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
删除不能登陆的http://mirrors.aliyuncs.com和http://mirrors.cloud.aliyuncs.com
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
生成缓存生效
运行 yum makecache
本文介绍如何将CentOS系统的默认镜像源更改为阿里云镜像源,包括备份原始镜像配置文件、下载阿里云提供的CentOS镜像配置、修改镜像源并删除无效链接,最后更新yum缓存使更改生效。
8万+

被折叠的 条评论
为什么被折叠?



