Skip links

Failed to download metadata for repo ‘appstream’: relocated CentOS mirror

You’ve installed an older CentOS version and most likely dnf fails to update or install packages. This error is due to CentOS mirror being relocated to the vault instead.

[root@av1 ~]# dnf install python3-librepo -y
Failed loading plugin "osmsplugin": No module named 'librepo'
CentOS Linux 8 - AppStream                                                                      426  B/s |  38  B     00:00    
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

In order to fix this error, you’ll have to rename the target mirror as follows:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*

Running any dnf command, updating and installing packages should be working just fine now.

Photo by Jason Dent on Unsplash

>