Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist — Centos 8 Fix
1 min readFeb 23, 2022
CentOS 8 on a server had an issue when I tried to update the system using yum update
or install something. The error message is: Failed to download metadata for repo:
[root@autocontroller ~]# yum update
CentOS-8 - AppStream 70 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
Fix Failed to download metadata for repo
CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. that’s means CentOS 8 will no longer receive development resources from the official CentOS project.
After Dec 31st, 2021, if you need to update your CentOS, you need to change the mirrors to vault.centos.org where they will be archived permanently.
So just follow the steps below to do that
- Go to the /etc/yum.repos.d/ directory.
cd /etc/yum.repos.d/
- Run the below commands to hash the mirror-list in all yum.repos.d files then replace the existed Baseurl with the vault.centos.org
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-*
- Then run yum update or install any package you want
yum update -y
Now it works :