In this article you will learn how to fix Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist.
If you try update CentOS 8 with dnf update or yum update commands you will receive the following error:
CentOS 8 can’t longer receive updates from CentOS project and it had reached the End Of Life on 2021. So we need to change mirror address links in our repos to CentOS Vault Mirror.
Fix Error Failed to download metadata for repo ‘appstream’
In this example I used root user but you can login as user and use sudo.
To change the repo URL to vault.centos.org goto repos directory:
# cd /etc/yum.repos.d/
Use sed command to replace url’s:
# 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 your CentOS or install packages
# yum update