Could not resolve host: mirrorlist.centos.org Centos 7

原因如下:

https://lists.centos.org/hyperkitty/list/discuss@lists.centos.org/thread/MHVDYBZEC2C434WR4O2VZ6G3AO2XKKHY/

This is because CentOS 7 has reached the end of its life. You need to modify your configuration to use https://vault.centos.org/ instead of the main mirrors.

解决方案:

Edit /etc/yum.repos.d/CentOS-Vault.repo, jump down to the end of the 
file, where you see c7.9.2009, and enable the sections base, updates, 
and extras for that version. Insert enabled=1. (This matches the default 
enables for the original distro.) c7.9.2009 is the last release available.


Edit /etc/yum.repos.d/CentOS-Base.repo and add enabled=0 to all 
sections. (Some optional sections already have this.)

详细步骤:

# 
vi /etc/yum.repos.d/CentOS-Vault.repo

  1. 填入以下内容(如果当前版本的url不存在)
# C7.9.2009
[C7.9.2009/-base]
name=CentOS-7.9.2009/ - Base
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[C7.9.2009-updates]
name=CentOS-7.9.2009 - Updates
baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[C7.9.2009-extras]
name=CentOS-7.9.2009 - Extras
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[C7.9.2009-centosplus]
name=CentOS-7.9.2009 - CentOSPlus
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

[C7.9.2009-fasttrack]
name=CentOS-7.9.2009 - Fasttrack
baseurl=http://vault.centos.org/7.9.2009/fasttrack/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
  1. 更改base 的enable 为0

ex:

# 查看系统版本
cat /etc/redhat-release
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容