CentOS : No URLs in mirrorlist error

Categorías:

Cuando aparece este mensaje de error en nuestro sistema Centos o basado en RedHat …

 

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
root@newsrventerpdbprd ~ 09:12:40 # yum install edb-pgpool43
CentOS Linux 8 - AppStream                                                                                                     88  B/s |  38  B     00:00    
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
root@newsrventerpdbprd ~ 09:13:54 #

 

 

Debemos realizar los siguientes pasos:

1 Ingresar al directorio /etc/yum.repos.d

┌─[19:18:18] unixpad [mcfee /etc/httpd/conf.d]
└─> ¯\_(ツ)_/¯ cd /etc/yum.repos.d/
┌─[19:21:58] unixpad [mcfee /etc/yum.repos.d]
└─> ¯\_(ツ)_/¯ ls -ltr 
total 112
-rw-r--r--  1 root root  963 Oct  8  2014 webtatic-testing.repo
-rw-r--r--  1 root root  963 Oct  8  2014 webtatic-archive.repo
-rw-r--r--. 1 root root 2893 Nov 29  2016 CentOS-Vault.repo
-rw-r--r--. 1 root root 1331 Nov 29  2016 CentOS-Sources.repo
-rw-r--r--. 1 root root  630 Nov 29  2016 CentOS-Media.repo
-rw-r--r--. 1 root root  314 Nov 29  2016 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  649 Nov 29  2016 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1309 Nov 29  2016 CentOS-CR.repo
-rw-r--r--. 1 root root 1664 Nov 29  2016 CentOS-Base.repo
-rw-r--r--  1 root root 1314 Oct  1  2020 remi-php74.repo
-rw-r--r--  1 root root  865 Mar  1  2021 webtatic.repo
-rw-r--r--  1 root root  750 Sep  2  2021 remi-safe.repo
-rw-r--r--  1 root root 2605 Sep  2  2021 remi.repo
-rw-r--r--  1 root root 1314 Sep  2  2021 remi-php81.repo
-rw-r--r--  1 root root 1314 Sep  2  2021 remi-php80.repo
-rw-r--r--  1 root root 1314 Sep  2  2021 remi-php73.repo
-rw-r--r--  1 root root 1314 Sep  2  2021 remi-php72.repo
-rw-r--r--  1 root root 1314 Sep  2  2021 remi-php71.repo
-rw-r--r--  1 root root 1314 Sep  2  2021 remi-php70.repo
-rw-r--r--  1 root root  456 Sep  2  2021 remi-php54.repo
-rw-r--r--  1 root root  855 Sep  2  2021 remi-modular.repo
-rw-r--r--  1 root root  446 Sep  2  2021 remi-glpi94.repo
-rw-r--r--  1 root root  446 Sep  2  2021 remi-glpi93.repo
-rw-r--r--  1 root root  446 Sep  2  2021 remi-glpi92.repo
-rw-r--r--  1 root root  446 Sep  2  2021 remi-glpi91.repo
-rw-r--r--  1 root root 1457 Sep  4  2021 epel-testing.repo
-rw-r--r--  1 root root 1358 Sep  4  2021 epel.repo
-rw-r--r--  1 root root  149 Aug 18 08:58 MariaDB.repo
┌─[19:22:06] unixpad [mcfee /etc/yum.repos.d]
└─> ¯\_(ツ)_/¯ 

Aquí vemos un ejemplo de salida.

Posterior a ello, debemos ejecutar los siguientes comandos

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-*

 

Una vez terminamos de ejecutar estos comandos, podemos instalar los paquetes que necesitemos, puesto que los comandos anteriores lo que hacen es cambiar la URL obsoleta de los repos por una URL que está actualizada.

root@newsrventerpdbprd /etc/yum.repos.d 09:18:46 #  yum install epel-release
Last metadata expiration check: 0:05:06 ago on Wed 02 Nov 2022 09:16:53 AM -05.
Package epel-release-8-13.el8.noarch is already installed.
Dependencies resolved.
==============================================================================================================================================================
 Package                                   Architecture                        Version                                Repository                         Size
==============================================================================================================================================================
Upgrading:
 epel-release                              noarch                              8-18.el8                               epel                               24 k

Transaction Summary
==============================================================================================================================================================
Upgrade  1 Package

Total download size: 24 k
Is this ok [y/N]: y
Downloading Packages:
epel-release-8-18.el8.noarch.rpm                                                                                              108 kB/s |  24 kB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                          34 kB/s |  24 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                      1/1 
  Running scriptlet: epel-release-8-18.el8.noarch                                                                                                         1/1 
  Upgrading        : epel-release-8-18.el8.noarch                                                                                                         1/2 
warning: /etc/yum.repos.d/epel-modular.repo created as /etc/yum.repos.d/epel-modular.repo.rpmnew

  Running scriptlet: epel-release-8-18.el8.noarch                                                                                                         1/2 
  Cleanup          : epel-release-8-13.el8.noarch                                                                                                         2/2 
  Running scriptlet: epel-release-8-13.el8.noarch                                                                                                         2/2 
  Verifying        : epel-release-8-18.el8.noarch                                                                                                         1/2 
  Verifying        : epel-release-8-13.el8.noarch                                                                                                         2/2 

Upgraded:
  epel-release-8-18.el8.noarch                                                                                                                                

Complete!
root@newsrventerpdbprd /etc/yum.repos.d 09:22:03 #

 

 

Saludos.