Centos8 yum 报错 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

首先建立一个备份文件夹

makedir /tmp/yum

然后备份文件

cd /etc/yum.repos.d
mv *.repo /tmp/yum

然后安装阿里源

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

然后清除yum缓存再重新生成yum缓存

yum clean all
yum makecache

如果报如下类似错误
Timeout was reached for http://mirrors.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml [Connection timed out after 30000 milliseconds]
Could not resolve host: mirrors.cloud.aliyuncs.com
则执行如下命令

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

参考阿里源链接:https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11QTXSya

说明
1、解决办法为综合网上各位大牛,亲测实现了的办法;

2、不一定能100%解决相似的问题,有错误或更好的办法欢迎留言评论;

3、若有侵犯个人或团体的权益请及时联系我;

4、本文为原创,转载或引用请注明出处

本文作者:逍遥子

本文连接:https://www.cnblogs.com/femme/p/15883208.html

版权:本人个人所有

posted @ 2022-02-11 14:57  ~逍遥子~  阅读(8256)  评论(0编辑  收藏  举报