问题描述
Repository extras is listed more than once in the configuration Errors during downloading metadata for repository 'base': - Status code: 404for https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 39.96.118.195) - Status code: 404for http://mirrors.cloud.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148) - Curl error (28): Timeout was reached for http://mirrors.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml [Connection timed out after 30000 milliseconds] Error: Failed to download metadata for repo 'base': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
先获取了阿里的yum源
wget-O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
运行yum makecache
时出现上述报错
问题分析
看报错应该是获取xml文件时404了
打开浏览器输入https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml
发现无法访问
逐级向上寻找 在https://mirrors.aliyun.com/centos/8/发现目录可以访问了,但是子目录下没有BaseOS
再次回退上级在centos目录下寻找,发现只有
https://mirrors.aliyun.com/centos/8-stream/目录下有yum的baseOS repo文件
顺着BaseOS路径往下找,确实找到了repomd.xml
至此问题找到了,应该是阿里云改了源文件结构但是在repo配置文件中没有同步修改,只需要修改一下repo文件中的路径信息就可以了
解决方法
sed-i's/$releasever/8-stream/g' /etc/yum.repos.d/CentOS-Base.repo
将文件中的路径信息修改成8-stream,就能够正常访问源了