CentOS8想安装一个软件一直报错:
[root@16fabbf889e5 ~]# yum install install wget
CentOS-8 - AppStream 79 B/s | 38 B 00:00
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'
检查外网也是通的:
[root@16fabbf889e5 ~]# ping www.baidu.com
PING www.a.shifen.com (110.242.68.3) 56(84) bytes of data.
64 bytes from 110.242.68.3 (110.242.68.3): icmp_seq=1 ttl=53 time=13.5 ms
64 bytes from 110.242.68.3 (110.242.68.3): icmp_seq=2 ttl=53 time=13.1 ms
原因是CentOS8停止维护了,需要更换源地址https://techglimpse.com/failed-metadata-repo-appstream-centos-8/
Step 1: Go to the /etc/yum.repos.d/
directory.
[root@autocontroller ~]# cd /etc/yum.repos.d/
Step 2: Run the below commands
[root@autocontroller ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@autocontroller ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Step 3: Now run the yum update
[root@autocontroller ~]# yum update -y
That’s it!