阿里云Centos8 yum报错Failed to synchronize cache for repo ‘BaseOS‘解决方案,通过换文件的方式来解决。

起因:

在阿里云上买了个centos服务器,但是yum的时候报错,查了下是连不上微软的源。

报这个错误:Error: Failed to synchronize cache for repo 'BaseOS'

报错如下:

[root@iZbp1j62zviuaiizue37Z yum.repos.d]# yum install -y lrzsz
CentOS-8 - AppStream                              103 kB/s | 4.4 kB     00:00    
CentOS-8 - Base                                    56 kB/s | 2.3 kB     00:00    
Error: Failed to synchronize cache for repo 'BaseOS'

解决办法,有让换BaseOS的链接的,还有换源文件的。

下面我们采取换文件的方式

1、先删除文件

rm -rf /etc/yum.repos.d/CentOS-Base.repo

2、再下载文件

curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo

3、清理老的缓存

dnf clean all

4、生成新的缓存

dnf repolist

5、执行完,出现下面的这个就可以了。

[root@iZbp1j62zviuaiizue37Z yum.repos.d]# dnf repolist
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8 - AppStream                              6.1 MB/s |  21 MB     00:03    
CentOS-8 - Base - repo.huaweicloud.com            2.9 MB/s | 4.6 MB     00:01    
CentOS-8 - PowerTools - repo.huaweicloud.com      3.8 MB/s | 2.3 MB     00:00    
CentOS-8 - Extras - repo.huaweicloud.com           34 kB/s |  10 kB     00:00    
repo id              repo name                                              status
AppStream            CentOS-8 - AppStream                                   15,665
BaseOS               CentOS-8 - Base - repo.huaweicloud.com                  1,896
PowerTools           CentOS-8 - PowerTools - repo.huaweicloud.com            1,693
extras               CentOS-8 - Extras - repo.huaweicloud.com                   38

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值