You may get the error: Failed to download metadata for repo ‘appstream’: while you are updating Centos 8 using the command yum and DNF.
Following is the complete description of the error.
Error:
Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorList: No URLs in mirrorlist
Solution:
Execute the following commands step by step using root login:
cd /etc/yum.repos.d/
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-*
Now you can update the local CentOS repository.
yum update
Thank you and have a nice day.