解决Centos8 yum源报错

1Centos8 yum安装软件时无法下载

[root@localhost ~]# yum -y install wget
CentOS-8 - AppStream                           0.0  B/s |   0  B     00:08    
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

2 检测网络

[root@localhost ~]# ping baidu.com
PING baidu.com (220.181.38.251) 56(84) bytes of data.
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=1 ttl=128 time=40.1 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=2 ttl=128 time=38.4 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=3 ttl=128 time=38.1 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=4 ttl=128 time=38.2 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=5 ttl=128 time=37.10 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=6 ttl=128 time=37.9 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=7 ttl=128 time=38.1 ms

3 删除大多数配置

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm *.repos

4 更换国内源

阿里源:https://developer.aliyun.com/mirror/centos

腾讯源:https://mirrors.tencent.com/help/centos.html

5 清理 yum缓存

yum clean all

6 建立新的缓存

yum makecache

 

posted @ 2022-02-07 16:18  #44  阅读(250)  评论(0)    收藏  举报