Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist No URLs in...

博主在使用yum源安装时候,出现下面错误“错误:Failed to download metadata for repo ‘AppStream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist

查阅资料发现是centos8在2021年年底停止了服务

Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist No URLs in..._第1张图片

现在提供一种解决方案亲测有效

1、进入yum的repos目录

cd /etc/yum.repos.d/

2、修改所有的CentOS文件内容

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

3.生成缓存

yum clean all

yum makecache

 4.运行yum update

yum update -y

更新时间稍微有点长,耐心等待即可 

Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist No URLs in..._第2张图片

使用yum安装httpd(已经可以使用,无任何报错)

Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist No URLs in..._第3张图片 

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