CentOS-8中使用yum命令报错‘Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: ...

今天在服务器使用yum命令的时候,报错‘Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

问题主要原因

CentOS-8在2021年12月31日停止了源的服务
使用如下命令查看系统是不是8

cat /etc/redhat-release
image.png

就解决步骤

1、打开/etc/yum.repos.d文件夹

cd /etc/yum.repos.d

2、新建bak文件夹并将文件拷贝进其中

mkdir bak
cp * bak/

执行这个命令可能会报错,无视就好


image.png

3、使用以下命令进行内容的替换

sed -i 's/$releasever/8-stream/' CentOS*repo

然后就可以接着执行你刚才的命令,推荐直接复制上面三个命令。

相关博文

【Bug解决】CentOS-8中“Failed to download metadata for repo ‘AppStream‘: Cannot download repomd.xml”_陈同学的博客-CSDN博客

你可能感兴趣的:(CentOS-8中使用yum命令报错‘Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: ...)