centos8.0 软件仓库报错Failed to synchronize cache for repo ‘base‘, ignoring this repo.

遇到的问题

以使用curl命令安装阿里centos8的镜像仓库,使用dnf repolist查看仓库时遇见如下报错

[root@localhost ~]# yum repolist
CentOS-8 - AppStream - mirrors.aliyun.com                   0.0  B/s |   0  B     00:24    
CentOS-8 - Base - mirrors.aliyun.com                        0.0  B/s |   0  B     00:24    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'base', ignoring this repo.
Last metadata expiration check: 0:23:35 ago on Wed 02 Feb 2022 08:52:22 AM EST.
repo id                    repo name                                                  status
extras                     CentOS-8 - Extras - mirrors.aliyun.com                     38

解决方法

查看dnf日志文件(/var/log/dnf.log)

2022-02-02T14:37:46Z DEBUG Cannot download 'https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried.
2022-02-02T14:37:46Z DEBUG repo: downloading from remote: base
2022-02-02T14:37:56Z DEBUG not found other for: CentOS-8 - Base - mirrors.aliyun.com
2022-02-02T14:37:56Z DEBUG not found modules for: CentOS-8 - Base - mirrors.aliyun.com

发现报错原因,并参试使用浏览器访问该网站,发现访问不了,可能是阿里方面维护或下线了该仓库

将软件仓库更改成华为仓库

# 删除原来的阿里软件仓库
[root@localhost ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo
# 下载华为centos8版本的软件仓库
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo

再次测试仓库是否可用

# 清理仓库缓存
[root@localhost ~]# dnf clean all
# 重新生成缓存并查看仓库软件包数量
[root@localhost ~]# dnf repolist
CentOS-8 - AppStream - repo.huaweicloud.com                 2.0 MB/s | 8.4 MB     00:04    
CentOS-8 - Base - repo.huaweicloud.com                      1.6 MB/s | 4.6 MB     00:02    
CentOS-8 - PowerTools - repo.huaweicloud.com                866 kB/s | 2.3 MB     00:02    
CentOS-8 - Extras - repo.huaweicloud.com                    4.3 kB/s |  10 kB     00:02    
repo id                   repo name                                                   status
AppStream                 CentOS-8 - AppStream - repo.huaweicloud.com                 5,596
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
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值