centos系统在安装某些yum依赖都会报错,是因为CentOS 开发团队在其官博宣布不在维护,已于2022暂停维护,接下来一年会把重心放到 CentOS Stream 上
一般报错内容如下:
Errors during downloading metadata for repository 'epel':
- Status code: 404 for http://archives.fedoraproject.org/pub/archive/epel/8/Everything/x86_64/repodata/repomd.xml (IP: 38.145.60.24)
Error: Failed to download metadata for repo 'epel': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
解决方法:
1、备份源文件夹
mv /etc/yum.repos.d /etc/yum.repos.d.bak
2 创建源文件目录
mkdir -p /etc/yum.repos.d
3 下载新的yum源
curl https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo > /etc/yum.repos.d/Centos-vault-8.5.2111.repo
curl https://mirrors.aliyun.com/repo/epel-archive-8.repo > /etc/yum.repos.d/epel-archive-8.repo
4 重建缓存
yum clean all && yum makecache