centos8报错:Errors during downloading metadata for repository ‘base‘

完整报错:

Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Base.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Base.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Base.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Base.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Base.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
CentOS-8 - Base - mirrors.aliyun.com                      0.0  B/s |   0  B     00:47    
Errors during downloading metadata for repository 'base':
  - Status code: 404 for https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 120.39.197.216)
  - Curl error (7): Couldn't connect to server for http://mirrors.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml [Failed to connect to mirrors.aliyuncs.com port 80: 拒绝连接]
错误:为仓库 'base' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

在网上找了很多资料都没用,最后在镜像站找到了原因:
centos8报错:Errors during downloading metadata for repository ‘base‘_第1张图片
是因为我之前配置阿里云镜像指令错了,以前是这样的:

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

因此解决方案为:

# 进入yum目录
cd /etc/yum.repos.d

# 删除目录下所有文件(注意完整复制,不要漏了那个点)
rm -rf ./*

# 安装正确的源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

# 生成缓存
yum makecache

如果有兴趣了解更多相关内容,欢迎来我的个人网站看看:瞳孔的个人空间

你可能感兴趣的:(运维,centos,服务器,linux)