As noted in the CentOS project timeline, traditional CentOS 7 repositories (mirrorlist.centos.org) became unavailable after December 31, 2021, when CentOS shifted focus to CentOS Stream. However, many production systems still running CentOS 7 need maintenance updates.
First verify basic network functionality:
ping -c 4 google.com
nslookup mirrorlist.centos.org
curl -I https://www.centos.org
If these fail, you're dealing with either DNS resolution issues or network connectivity problems.
Edit your resolv.conf:
sudo vi /etc/resolv.conf
Add reliable nameservers:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1
Since official mirrors are deprecated, use these alternatives:
1. Vault.centos.org (archive):
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
2. Alibaba Cloud mirrors (faster in Asia):
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
For critical packages like wget when yum fails:
curl -O http://vault.centos.org/7.9.2009/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm
sudo rpm -ivh wget-*.rpm
To prevent DNS changes from reverting after reboot:
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
Add:
DNS1=8.8.8.8
DNS2=8.8.4.4
sudo yum clean all
sudo yum makecache
sudo yum install -y nano
The error occurs when your CentOS 7 system cannot resolve the official repository domains. This typically indicates either:
- DNS resolution problems
- Outdated repository configurations
- Network connectivity issues
First, verify basic network connectivity:
ping -c 4 google.com
If this fails, check your network configuration:
nmcli connection show
cat /etc/resolv.conf
If DNS resolution is the problem, manually configure resolvers:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
echo "nameserver 1.1.1.1" | sudo tee -a /etc/resolv.conf
Option 1: Using vault.centos.org
Edit the base repository file:
sudo vi /etc/yum.repos.d/CentOS-Base.repo
Replace mirrorlist entries with:
[base]
name=CentOS-$releasever - Base
baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Option 2: Using Community Mirrors
Example using MIT mirror:
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.mit.edu/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
For immediate needs, download packages manually:
curl -O https://vault.centos.org/centos/7/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm
sudo rpm -ivh wget-*.rpm
After making changes:
sudo yum clean all
sudo yum makecache
sudo yum install -y wget