The error message “Failed to Download Metadata for Repo ‘AppStream'” appears on CentOS 8 servers and you have probably encountered it if you tried to update the system (yum update).
[root@netshop-centos8-srv ~]# yum update
CentOS-8 - AppStream 110 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
In this tutorial we are going to show you how to fix this error and continue normally with updating your CentOS 8 server.
Step 1 – Go to /etc/yum.repos.d/ directory
Execute the following command in bold:
[root@netshop-centos8-srv ~]# cd /etc/yum.repos.d/
Step 2 – Run the following sed commands
[root@netshop-centos8-srv ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* [root@netshop-centos8-srv ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Step 3 – Now run Yum Update
[root@netshop-centos8-srv ~]# yum update -y
That’s it!