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 error on CentOS 8 with same error code below
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
Why I get error like 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 is 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
:
sudo sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-* sudo sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
They essentially replace the base URL with the one that is still functioning. This should solve the issue for a while, but keep in mind that you won’t receive any updates for CentOS 8 anymore. In the long run, try to upgrade to the Stream version.
CentOS 8 installation
as I described above, I’d like to show how to fix a similar issue with a new CentOS 8 installation, namely, “Error setting up base repository”. I was setting up CentOS on a virtual machine, and here’s how the issue looked like:
again, as I info above. Good thing is that the legacy repository is still available, just under a different address: https://vault.centos.org
To fix the issue, first go to “Network & Host Name” section, enable the Ethernet connection and click “Done” (you might need to set up proper network settings in a more complex case):
Now go to “Installation source”. The “On the network” section should now be editable. Tip: if your “Installation source” button is not clickable and greyed out, click on any other section button and go back by pressing “Done”, this should reset the UI.
Now set up the https://
protocol by clicking the “Closest mirror” dropdown and enter the URL of the repository similar to the following: https://vault.centos.org/8.5.2111/BaseOS/x86_64/os/
I used version 8.5 64-bit distribution, but you may want to search for the version that’s suitable for you on https://vault.centos.org
Now your “Installation Source” section should be fixed, and you may proceed to “Software Selection” and other sections of the setup.
Hope this article will help you