Wednesday, April 24, 2024
Google search engine
HomeLinux TutorialsNo URLs in mirrorlist error on CentOS 8

No URLs in mirrorlist error on CentOS 8

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:

No URLs in mirrorlist error on CentOS 8
click for zoom

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):

No URLs in mirrorlist error on CentOS 8 2
click for zoom

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.
No URLs in mirrorlist error on CentOS 8 3
click for zoom

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

No URLs in mirrorlist error on CentOS 8 4
click for zoon

Now your “Installation Source” section should be fixed, and you may proceed to “Software Selection” and other sections of the setup.

No URLs in mirrorlist error on CentOS 8 5
click for zoon

Hope this article will help you

YOU CAN SUPPORT DEVNINJA WITH A CUP OF COFFEE

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online. to search or browse the published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or more ) as a token of appreciation.

Support Us

DevNinja
DevNinja
System & Network Administrator Ninja
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

11 + 7 =

- Advertisment -
Google search engine

Most Popular

Recent Comments