If you are compelled to use CentOS 8 or have any other reason to have it still running on your system. Then I hope you know that CentOS 8 has died and reached its End Of Life (EOL) on December 31st, 2021.
If you still want to have it as your default distribution or use it in a virtual machine, then you may have encountered the following error while updating or installing packages.
“Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist”
How Should I Solve This Error?
As I’ve mentioned earlier, CentOS 8 died and reached End Of Life (EOL) on December 31st, 2021. It means you will no longer receive any packages or security updates from the official CentOS project.
This means the default CentOS 8 mirror or repository is no longer active and maintained. To update your system and install packages, you need to switch to the CentOS Vault Mirror, where they will be archived permanently.
Fix Error: Failed to Download Metadata for Repo ‘AppStream’
To fix this error, open your terminal using Ctrl+Alt+t keyboard shortcuts and use the sed command to switch the repository URL to vault.centos.org, from the official CentOS repository, as shown below.
# 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-*
Otherwise, you can use the cloudflare based vault repository by executing the following commands.
# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-Linux-*
Now you should be able to update or download a new package on your CentOS 8 system.
However, you can easily migrate from CentOS 8 to CentOS Stream 8 to have new packages and security updates for your Linux system.
Innovative tech mind with 12 years of experience working as a computer programmer, web developer, and security researcher. Capable of working with a variety of technology and software solutions, and managing databases.