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

preface

centos8 stopped the service of source on December 31, 2021

The current system is CentOS

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

Yum error message

[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 ~]# 

Solution

1. Execute the following commands

[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. If the problem is not solved, do the following:

[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. Then perform the following operations

[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]#

At this point, you can use the yum install command.

Read More: