CentOS 8: No URLs in mirrorlist error
If you use CentOS 8, you might have noticed that starting from January 31, 2022, installing packges with yum
no longer works with an error No URLs in mirrorlist
, similar to the following:
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
The same issue could hit you if you use Docker container images based on centos:8
What is the reason behind this? Why did everything work fine just yesterday? This short article explains the reason of the error and how to solve it.
On January 31, 2022, CentOS team has finally removed all packages for CentOS 8 from the official mirrors. CentOS 8 has reached its end-of-life on December 31, 2021, but the packages were kept on the official mirrors for a while. Now they’re moved to https://vault.centos.org
The proper way of handling the issue would be to migrate to CentOS Stream 8. But what if you can’t afford this? Here’s a solution that worked for me.
If you still need to run your old CentOS 8, you can update the repos in /etc/yum.repos.d
to use vault.centos.org
instead of mirror.centos.org
. Here are two simple commands to do this, both need to be run with sudo
: