Saturday 16 July 2022

How to Resolve YUM Repo Mirror URLs List Issue on CentOS 8



Sometime mirror URLs does not work on CentOS 8 systems and gives the below error. To solve the yum repo issue need to replace it with base URLs.

[root@linuxcnf ~]# yum update
CentOS-8 - AppStream                                                                    73 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
[root@linuxcnf ~]#

This article describes How to Resolve YUM Repo Mirror List Issue on CentOS 8.
 
Step 1. Change Repo Configuration: Run the following sed commands to hash the mirror-list in all yum.repos.d files and then replace the existed Base URLs with the vault.centos.org
 
[root@linuxcnf ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@linuxcnf ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
[root@linuxcnf ~]#
 
Step 2. Validate Repositories: Run the below command to validate the repository issue if it is resolve or not:
 
[root@linuxcnf ~]# yum makecache
CentOS Linux 8 - AppStream                      3.8 MB/s | 8.4 MB     00:02
CentOS Linux 8 - BaseOS                         3.2 MB/s | 4.6 MB     00:01
CentOS Linux 8 - Extras                          12 kB/s |  10 kB     00:00
Metadata cache created.
[root@linuxcnf ~]#
 
Done!!! Now the repository URLs issue is resolved on CentOS 8.

1 comment: