凌的博客

您现在的位置是: 首页 > 学无止境 > Linux > 

Linux

centos8更换国内源(阿里源)

2021-11-19 Linux 1144
yum clean all


备份配置文件

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


下载最新的

wget -O /etc/yum.repos.d/CentOS-Base.repo  
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo


并替换部分字段(非阿里云机器需要做)

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo


 生成缓存

 yum makecache


更新yum

yum -y install

已加载插件:fastestmirror, refresh-packagekit, security

设置更新进程Loading mirror speeds from cached hostfile

* base: mirrors.aliyun.com

* extras: mirrors.aliyun.com

* updates: mirrors.aliyun.com





文章评论

0条评论