yum: Error: Failed to download metadata for repo ‘aliyun-AppStream‘: Cannot download repomd.xml

前言

centOS8 于2021年12月31日停止了源的服务

当前系统为 CentOS

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 8.5.2111
[root@localhost ~]# 

yum 错误信息

[root@localhost ~]# yum install ipmitool
CentOS-8 - AppStream                                                                                                                                                                   439  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 182.105.147.113)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost ~]# 

解决方案

1. 执行如下命令

[root@localhost ~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# ls -lh        
total 24K
-rwxr-xr-x. 1 root root  288 Mar 22 20:07 CentOS-AppStream.repo
-rwxr-xr-x. 1 root root  276 Mar 22 20:07 CentOS-BaseOS.repo
-rwxr-xr-x. 1 root root 3.0K Mar 22 20:07 CentOS-Base.repo
-rwxr-xr-x. 1 root root  279 Mar 22 20:07 CentOS-Extras.repo
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum update -y
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
CentOS-8 - AppStream                                                                                                                                                             437  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 124.225.134.244)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

2.未解决问题,进行如下操作

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-03-22 20:08:42--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.225.134.241, 124.225.134.239, 124.225.134.243, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.225.134.241|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/CentOS-Base.repo                    100%[===================================================================================================================>]   2.44K  --.-KB/s    in 0s      

2022-03-22 20:08:47 (49.0 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum clean all
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
18 files removed
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum makecache
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
CentOS-8 - AppStream                                                                                                                                                             428  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 119.41.210.242)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost yum.repos.d]# 

3. 接着执行如下操作

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# ls -lh        
total 24K
-rwxr-xr-x. 1 root root  288 Mar 22 20:07 CentOS-AppStream.repo
-rwxr-xr-x. 1 root root  276 Mar 22 20:07 CentOS-BaseOS.repo
-rwxr-xr-x. 1 root root 3.0K Mar 22 20:07 CentOS-Base.repo
-rwxr-xr-x. 1 root root  279 Mar 22 20:07 CentOS-Extras.repo
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv  *.repo  bak
[root@localhost yum.repos.d]# ls
bak
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-03-22 20:10:10--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.225.134.239, 124.225.134.241, 124.225.134.243, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.225.134.239|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/CentOS-Base.repo   100%[==================================================================>]   2.44K  --.-KB/s    in 0s      

2022-03-22 20:10:15 (98.3 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum clean all
0 files removed
[root@localhost yum.repos.d]# yum makecache
CentOS-8.5.2111 - Base - mirrors.aliyun.com                                                                                     454 kB/s | 4.6 MB     00:10    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                                                                                                                    1.0 kB/s |  10 kB     00:10    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com                                                                                                                                 571 kB/s | 8.4 MB     00:15    
Metadata cache created.
[root@localhost yum.repos.d]# ls 
bak  CentOS-Base.repo
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum install ipmitool
Last metadata expiration check: 0:00:27 ago on Tue 22 Mar 2022 08:10:54 PM CST.
Dependencies resolved.
=================================================================================================================================================================================================================
 Package                                          Architecture                                   Version                                                 Repository                                         Size
=================================================================================================================================================================================================================
Installing:
 ipmitool                                         x86_64                                         1.8.18-18.el8                                           AppStream                                         395 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package

Total download size: 395 k
Installed size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
ipmitool-1.8.18-18.el8.x86_64.rpm                                                                                                                                                 71 kB/s | 395 kB     00:05    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             71 kB/s | 395 kB     00:05     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                         1/1 
  Installing       : ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 
  Running scriptlet: ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 
  Verifying        : ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 

Installed:
  ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                                                  

Complete!
[root@localhost yum.repos.d]#

至此,便可以使用 yum install 命令了。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值