阿里云 Centos8 yum 报错

1
2
3
4
5
Repository extras is listed more than once in the configuration
CentOS Linux 8 - AppStream 18 kB/s | 2.3 kB 00:00
Errors during downloading metadata for repository 'appstream':
- Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
1
2
3
4
5
6
7
8
9
10
11
12
13
# 1、执行如下命令先将之前的yum文件备份:
rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo

# 2、运行以下命令下载最新的repo文件:
wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo
wget https://mirrors.aliyun.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo

# 3、运行以下命令替换repo文件中的链接:
sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo

# 4、运行以下命令重新创建缓存,若没报错,则正常了。
yum clean all && yum makecache