作者:Yao2502880171 | 来源:互联网 | 2023-09-06 13:03
CentOS8设置国内镜像源(阿里云)1、备份原有配置[root@localhost~]#mkdiretcyum.repos.d.bak[root@localhost~]#mvet
CentOS8设置国内镜像源(阿里云)
1、备份原有配置
[root@localhost ~]# mkdir /etc/yum.repos.d.bak
[root@localhost ~]# mv /etc/yum.repos.d/* /etc/yum.repos.d.bak/
[root@localhost ~]# ll /etc/yum.repos.d/
[root@localhost ~]# ll /etc/yum.repos.d.bak/
2、下载阿里云镜像配置
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3、修改配置文件
- 删除"mirrors.cloud.aliyuncs.com" 及 "mirrors.aliyuncs.com" 字符串所在的行
[root@localhost ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
- 替换 "releasever/" 为 "releasever-stream/"
[root@localhost ~]# sed -i 's/releasever\//releasever-stream\//g' /etc/yum.repos.d/CentOS-Base.repo
3、重置缓存
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
4、测试
[root@localhost ~]# yum -y install dos2unix
本文来自博客园,作者:99号程序员,转载请注明原文链接:https://www.cnblogs.com/yyxp/p/16212996.html