If you have CentOS 8 installed, you may be starting to experience a new error with the repositories. The cause is the change of the repository addresses. “CentOS Linux 8 – AppStream Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist” you will see it when your CentOS 8 Linux wants to install or update packages with yum or dnf.

The error occurs when trying to access the repositories, starting with appstream, and prevents us from upgrading or installing new packages on CentOS 8 Linux.

The change from CentOS 8 to CentOS 8 Stream has completed the URL change for the data repositories and therefore we have to modify the data sources to download or update packages. The command line process is relatively straightforward, but even so we always recommend making a copy of the server, if you have it virtualised it’s easy, just take a snapshot.

Run this line first to comment out the lines in the old CentOS 8 repository. This will add a # to comment out the lines in the mirrors list.

sudo sed -i -e “s|mirrorlist=|#mirrorlist=|g” /etc/yum.repos.d/CentOS-*

Then we need to run this other command:

sudo sed -i -e “s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g” /etc/yum.repos.d/CentOS-*

So we’ll replace everything starting with #baseurl with a new line that already contains the new repository URL:

baseurl=http://vault.centos.org/$contentdir/$releasever/App

Scroll to Top