惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Scott Helme
Scott Helme
N
Netflix TechBlog - Medium
AI
AI
Security Latest
Security Latest
GbyAI
GbyAI
P
Proofpoint News Feed
Y
Y Combinator Blog
A
Arctic Wolf
G
Google Developers Blog
U
Unit 42
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
T
Tor Project blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
C
Check Point Blog
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
博客园 - Franky
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
Cisco Blogs
云风的 BLOG
云风的 BLOG
NISL@THU
NISL@THU
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
Latest news
Latest news
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
WordPress大学
WordPress大学
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
The Hacker News
The Hacker News
Simon Willison's Weblog
Simon Willison's Weblog
V
V2EX
Project Zero
Project Zero
博客园_首页

博客园 - 007少侠

使用Recaf编辑汇编代码直接修改java的编译代码class 如何在Docker容器中的Linux系统(Ubuntu + Centos Linux)里面使用systemctl Centos Linux 7 搭建邮件服务器(postfix + dovecot) Ubuntu Linux 搭建邮件服务器(postfix + dovecot) 【WSL2】在Windows通过自定义域名访问wsl2中的服务 Python pip pip3 源设置成国内源,阿里云源,清华大学源 利用云服务器实现内网穿透(frp),开启个人电脑(windows)可远程桌面访问 使用docker安装centos7并挂载主机目录 Rust交叉编译Mac编译Linux/Windows平台 Linux下安装dart sdk并配置环境变量 Linux下安装JDK-openj9并配置环境变量 centos7 安装 bbr加速 linux环境常用命令和java/jvm常用命令 mybatis plus + druid多数据源(使用dynamic实现) docker将容器打包成镜像并传输至其他服务器部署(可用于容器重新run) .gitignore == git添加忽略不生效解决方案 jenkins自动构建项目源码git pull时出现冲突的终极解决方案(git远程覆盖本地分支) mysql查询,根据时间查询:几天前、几天内的数据 spring boot 使用aop实现拦截器
Centos Linux 更换源,原官方源已经不再提供服务
007少侠 · 2024-08-10 · via 博客园 - 007少侠

前言

CentOS 7的生命周期已经在2024年6月30日终止(End of Life,EOL),官方将不再对该版本进行问题修复、功能更新以及其他形式的维护支持。这意味着使用 CentOS 7 的用户将面临安全漏洞无法得到修补的风险,同时随着其他软件的更新,可能会出现不兼容的情况。

随着 CentOS 7的生命周期结束,http://mirrorlist.centos.org 也不再提供服务。因为 http://mirrorlist.centos.org 是 CentOS 系统中用于寻找可用软件包镜像的关键服务,意味着 CentOS 用户将无法通过该服务获取最新的镜像列表,会影响软件包的管理功能。

在 CentOS 7中再使用 yum 安装软件包或者编译基于 CentOS 的 Docker 镜像时,会报如下错误:

Could not resolve host: mirrorlist.centos.org

使用 nslookup 看下 http://mirrorlist.centos.org 会发现的确不再提供服务,如下

PS C:\Users\Bingo> nslookup mirrorlist.centos.org
服务器:  public1.114dns.com
Address:  114.114.114.114

DNS request timed out.
    timeout was 2 seconds.
*** public1.114dns.com 找不到 mirrorlist.centos.org: Non-existent domain

解决方案

CentOS 旧版本的软件包和已不再维护的 CentOS 版本都会被存储到 http://vault.centos.org,所以只需要将 repo 文件的 baseurl 由 http://mirrorlist.centos.org 改为 http://vault.centos.org 即可

1、备份旧的源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old

2、查看Centos系统版本

[root@1drk384l6e8r9t3 ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

3、新建新的CentOS-Base.repo并粘贴如下配置保存(自己替换成上一步查询到的版本)

vim /etc/yum.repos.d/CentOS-Base.repo
# 粘贴如下配置信息并保存
[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

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

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

4、清理缓存并生成新的缓存

sudo yum clean all
sudo yum makecache

5、运行 yum repolist 命令,确保新源已生效

 显示如下

[root@1drk384l6e8r9t3 ~]# sudo yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                                                         repo name                                                                            status
base/x86_64                                                                     CentOS-7 - Base                                                                      10,072
extras/x86_64                                                                   CentOS-7 - Extras                                                                       526
updates/x86_64                                                                  CentOS-7 - Updates                                                                    6,173
repolist: 16,771