How to Fix Error Failed to Download Metadata for Repository on CentOS 8
Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist
The CentOS 8 distribution has stopped receiving updates since December 31, 2021. This means that servers using CentOS 8 are no longer supported by the Official CentOS project.
A common error that CentOS administrators have encountered is the one described below:
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlistTo resolve this error you need to change the mirrors pointing them to this new address: vault.centos.org.
To do this follow these steps:
Step 1 – Enter the “/etc/yum.repos.d/” directory
cd /etc/yum.repos.d/Step 2 – Use “Sed” which is a very common command in Linux to replace string
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*Then this other command:
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*Step 3 – Clear cache to search for packages
You can optionally use these commands to clear cached data and check for available packages for upgrade.
yum clean all
yum check-updateRemembering that in Centos 8 both yum and dnf can be used for package management.
