CentOS-8.4系统配置国内清华镜像站yum源

一、为啥要更改yum源

1、Centos 8官方已于2021年12月31日以后停止Centos 8支持、转至Centos 8 Stream项目支持2021年12月31日以后,CentOS Linux 8的使用者将无法获得包括问题修复和功能更新在内的任何软件维护和支持。

2、Centos Stream 是一个面向开发者的滚动发布的 Linux 发行版,CentOS Streams 可以当成是用来体验最新红帽系 Linux 特性的一个版本。

3、因此,你追求稳定性,或者个人日常使用,都更推荐使用传统的 CentOS Linux 这个版本。

4、官方渠道已经停止了CentOS8的下载,只有CentOS8-stream,我们可以去清华大学开源软件镜像站下载centos-vault版本

https://mirrors.tuna.tsinghua.edu.cn/centos-vault/

 

 

 

 二、系统安装完成后,准备修改yum源

1、确保网络可以连接外网

ping -c 4 baidu.com

 2、更改yum源为清华源

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 8.4.2105
[root@localhost ~]# 
[root@localhost ~]# minorver=8.4.2105
[root@localhost ~]# 
[root@localhost ~]# sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" -e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/$minorver|g" -i.bak /etc/yum.repos.d/CentOS-*.repo
[root@localhost ~]# 

查看系统版本号 8.4.2105

minorver=8.4.2105 将系统版本号作为下条命令的变量值

修改yum源地址

sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" -e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/$minorver|g" -i.bak /etc/yum.repos.d/CentOS-*.repo
3、测试yum源是否可用

[root@localhost ~]# yum clean all
18 文件已删除
[root@localhost ~]# yum makecache 
CentOS Linux 8 - AppStream                                                                                                                     6.0 MB/s | 9.6 MB     00:01    
CentOS Linux 8 - BaseOS                                                                                                                        7.2 MB/s | 8.5 MB     00:01    
CentOS Linux 8 - Extras                                                                                                                         23 kB/s |  10 kB     00:00    
元数据缓存已建立。
[root@localhost ~]# 
[root@localhost ~]# yum repolist 
仓库 id                                                                        仓库名称
appstream                                                                      CentOS Linux 8 - AppStream
baseos                                                                         CentOS Linux 8 - BaseOS
extras                                                                         CentOS Linux 8 - Extras
[root@localhost ~]# 

元数据缓存已建立。证明yum源配置正确,显示的仓库id表示yum源可正常使用

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值