Fix yum Errors: DNS, Repositories, and CentOS 7 EOL


Publication date:

Updated:


INFORMATION > Fix yum Errors: DNS, Repositories, and CentOS 7 EOL

Bottom line: First determine whether the host lacks network connectivity, DNS resolution, or a valid enabled repository. On CentOS 7, normal mirror failures can also be a lifecycle problem: CentOS Linux 7 reached end of life on June 30, 2024, so migrating is safer than repointing an internet-facing production server to archived packages.

What you'll learn

  • How yum uses repository metadata and why “Could not resolve host” points to DNS.
  • How to separate routing, resolver, repository, and operating-system lifecycle failures.
  • Why current RHEL-family systems use DNF even when a yum compatibility command exists.

Who this is for: Linux administrators diagnosing package-manager errors on an older RHEL-family host.

2026 context: The CentOS 7 commands and mirror URLs below are retained as historical troubleshooting context. Do not treat vault repositories as a substitute for security-supported software; plan a tested migration to a supported platform.

Overview

This guide explains how yum selects repositories and how to diagnose common mirrorlist failures. Errors such as "Could not retrieve mirrorlist http://mirrorlist.centos.org/?" and "curl#6 - "Could not resolve host: mirrorlist.centos.org;"" usually point to missing network connectivity, DNS resolution, or a valid enabled repository rather than to yum itself.

Table of Contents

  1. What is yum?
  2. Why yum fails
  3. Conclusion

1. What is yum?

yum is a package manager. A command such as yum install httpd resolves dependencies and downloads repository metadata and RPM packages from enabled software repositories.

1-1. How yum works

At a high level, yum:

  • reads enabled repository definitions from /etc/yum.repos.d/;
  • resolves a mirror or base URL; and
  • downloads metadata and packages from the selected software repository.

A CentOS 7 repository definition looked like this:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

The mirrorlist entry tells yum where to obtain a list of mirrors. Variables such as $releasever, $basearch, and $infra are expanded for the current system. In the original environment, this produced http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=.

At the time, that endpoint returned mirror URLs such as:

http://ftp.riken.jp/Linux/centos/7.9.2009/os/x86_64/
http://ftp.nara.wide.ad.jp/pub/Linux/centos/7.9.2009/os/x86_64/
http://ftp.jaist.ac.jp/pub/Linux/CentOS/7.9.2009/os/x86_64/
http://mirrors.cat.net/centos/7.9.2009/os/x86_64/
http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/os/x86_64/
http://ftp.yz.yamagata-u.ac.jp/pub/linux/centos/7.9.2009/os/x86_64/
http://ty1.mirror.newmediaexpress.com/centos/7.9.2009/os/x86_64/
http://ftp-srv2.kddilabs.jp/Linux/packages/CentOS/7.9.2009/os/x86_64/
http://mirror.vastspace.net/centos/7.9.2009/os/x86_64/
http://mirror.nus.edu.sg/centos/7.9.2009/os/x86_64/

yum then downloaded repository metadata and RPM packages from a selected mirror.

2. Why yum fails

Understanding the yum workflow makes it easier to identify where a request fails.

2-1. Cause 1: No network route

A network-based repository cannot be reached if the host has no usable route to it. Local-only repositories are an exception.

Test basic connectivity with an appropriate diagnostic for your environment, such as ping 8.8.8.8 where ICMP is permitted. A failed ping alone is not proof of an outage because many networks block ICMP; also check routes and an HTTPS connection to an approved endpoint.

2-2. Cause 2: DNS resolution fails

Repository URLs normally use host names. An error such as Could not resolve host: mirrorlist.centos.org means the resolver could not map that name to an IP address.

Check the configured resolver and query the repository host with an available tool such as getent hosts, dig, or host. A failed ping is not sufficient evidence because ICMP may be blocked.

2-3. Cause 3: No valid enabled repository

If routing and DNS work, inspect the enabled definitions under /etc/yum.repos.d/. A repository can fail because its configuration is missing or disabled, its URL is obsolete, or its release has reached end of life.

The following is the historical CentOS 7 base definition shown earlier. Its public mirror infrastructure is no longer a supported source for a current production system.

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

3. Conclusion

Separate the problem into routing, DNS resolution, and repository configuration. For CentOS 7, also account for end of life: archived packages do not restore security support, so the durable solution is a tested migration to a supported operating system.

Official references