CentOS8 failed to synchronize the warehouse cache after replacing the yum source

Cause of the problem: at first, the default yum source of CentOS 8 can be used normally, but after the Development Tools is installed with the following command:

yum groupinstall -y "Development Tools"

I don't know why I started to have the problem of synchronization warehouse cache failure, and I couldn't install some toolkits normally. The error message is as follows:

[root@localhost /etc/yum.repos.d]# yum makecache
CentOS-8.0 - AppStream                                    19  B/s |  38  B     00:02    
CentOS-8.0 - Base                                         24  B/s |  38  B     00:01    
CentOS-8.0 - Extras                                       8.4  B/s |  38  B     00:04    
Synchronization of warehouse 'AppStream' cache failed, ignoring this repo.
Synchronization of warehouse 'BaseOS' cache failed, ignoring this repo.
Synchronization of warehouse 'extras' cache failed, ignoring this repo.
Metadata cache established.
[root@localhost /etc/yum.repos.d]#

According to the error prompt information, we went to the Internet to find the relevant solutions, most of which were to replace Alibaba's yum source, and then we changed it according to the instructions in the official documents:

I thought it had been solved successfully, but I didn't expect that there was still a pit. When the metadata cache was re established, it still prompted that the synchronization warehouse cache failed:

[root@mesos-master /etc/yum.repos.d]# yum makecache
CentOS-8.0 - AppStream - mirrors.aliyun.com                   0.0  B/s |   0  B     00:24    
CentOS-8.0 - Base - mirrors.aliyun.com                        0.0  B/s |   0  B     00:32    
CentOS-8.0 - Extras - mirrors.aliyun.com                      0.0  B/s |   0  B     00:32    
CentOS-8.0 - Epel                                             2.3 MB/s | 6.0 MB     00:02    
WANdisco SVN Repo 1.9                                         2.0 kB/s | 121 kB     01:01    
Failed to synchronize warehouse 'AppStream' cache, ignoring this repo.
Failed to synchronize warehouse 'base' cache, ignoring this repo.
Synchronization of warehouse 'extras' cache failed, ignoring this repo.
Last metadata expiration check: before 0:00:01, 10:26:48 on Monday, March 23, 2020.
Metadata cache established.
[root@mesos-master /etc/yum.repos.d]#

Then I couldn't think about it. I thought that the default yum source of the system might not even be connected because of the network. The domestic source shouldn't be. Is there a problem with the configuration? It turns out that the $releaser and $basearch placeholders in the baseurl are somehow invalid. So change $releaser to 8, and change $basearch to x86 ʄ to solve the problem. The modified configuration files are as follows:

### cat CentOS-Base.repo ###
[base]
name=CentOS-8 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/
        http://mirrors.aliyuncs.com/centos/8/BaseOS/x86_64/os/
        http://mirrors.cloud.aliyuncs.com/centos/8/BaseOS/x86_64/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

### cat CentOS-AppStream.repo ###
[AppStream]
name=CentOS-8 - AppStream - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/
        http://mirrors.aliyuncs.com/centos/8/AppStream/x86_64/os/
        http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

### cat CentOS-Extras.repo ###
[extras]
name=CentOS-8 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/extras/x86_64/os/
        http://mirrors.aliyuncs.com/centos/8/extras/x86_64/os/
        http://mirrors.cloud.aliyuncs.com/centos/8/extras/x86_64/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

### cat CentOS-Epel.repo ###
[epel]
name=CentOS-$releasever - Epel
baseurl=http://mirrors.aliyun.com/epel/8/Everything/$basearch
enabled=1
gpgcheck=0

### cat CentOS-PowerTools.repo ###
[PowerTools]
name=CentOS-8 - PowerTools - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/PowerTools/x86_64/os/
        http://mirrors.aliyuncs.com/centos/8/PowerTools/x86_64/os/
        http://mirrors.cloud.aliyuncs.com/centos/8/PowerTools/x86_64/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

### cat CentOS-centosplus.repo ###
[centosplus]
name=CentOS-8 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos/8/centosplus/x86_64/os/
        http://mirrors.aliyuncs.com/centos/8/centosplus/x86_64/os/
        http://mirrors.cloud.aliyuncs.com/centos/8/centosplus/x86_64/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

After the above modifications are completed, the problem is solved, and there is no further prompt about the failure of synchronizing the warehouse cache:

[root@localhost /etc/yum.repos.d]# yum makecache
CentOS-8 - AppStream - mirrors.aliyun.com                      2.1 MB/s | 6.5 MB     00:03    
CentOS-8 - Base - mirrors.aliyun.com                           1.6 MB/s | 5.0 MB     00:03    
CentOS-8 - Extras - mirrors.aliyun.com                         1.8 kB/s | 4.2 kB     00:02    
CentOS-8.0 - Epel                                              2.2 MB/s | 6.0 MB     00:02    
WANdisco SVN Repo 1.9                                          10 kB/s | 121 kB     00:11    
//Metadata cache established.
[root@localhost /etc/yum.repos.d]# 

Tags: Linux CentOS yum EPEL RPM

Posted on Mon, 23 Mar 2020 07:39:35 -0400 by Dlex