centos7执行yum操作时报错Could not retrieve mirrorlist http://mirrorlist.centos.org解决

**原因:**CentOS 7 的官方仓库在 2024 年 6 月 30 日之后已经停止维护,不需要再去检查什么网络、DNS等乱七八糟的,因为这玩意都停止维护了,就算其他配置正常也照样不通。

**解决:**将CentOS-Base.repo文件替换成下面的配置

javascript 复制代码
[root@VM-20-15-centos]# cd /etc/yum.repos.d
[root@VM-20-15-centos yum.repos.d]# cat 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

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

[root@VM-20-15-centos yum.repos.d]# yum clean all
[root@VM-20-15-centos yum.repos.d]# yum update

这里由于之前由腾讯云yum源换aliyun的yum源时执行yum update出现了这个报错,所以用了以上方法解决了yum update问题,然后感觉还是喜欢阿里云,所以就换上阿里云了,再执行yum update就没报错了,换阿里云的操作步骤如下:

javascript 复制代码
// 习惯性备份
mv CentOS-Base.repo CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum update
相关推荐
正在努力的小河40 分钟前
Linux设备树简介
linux·运维·服务器
荣光波比42 分钟前
Linux(十一)——LVM磁盘配额整理
linux·运维·云计算
LLLLYYYRRRRRTT1 小时前
WordPress (LNMP 架构) 一键部署 Playbook
linux·架构·ansible·mariadb
轻松Ai享生活1 小时前
crash 进程分析流程图
linux
大路谈数字化3 小时前
Centos中内存CPU硬盘的查询
linux·运维·centos
luoqice4 小时前
linux下查看 UDP Server 端口的启用情况
linux
倔强的石头_5 小时前
【Linux指南】动静态库与链接机制:从原理到实践
linux
赏点剩饭7785 小时前
linux中的hostpath卷、nfs卷以及静态持久卷的区别
linux·运维·服务器
神鸟云5 小时前
DELL服务器 R系列 IPMI的配置
linux·运维·服务器·网络·边缘计算·pcdn
herderl5 小时前
**僵尸进程(Zombie Process)** 和**孤儿进程(Orphan Process)**
linux·运维·服务器·网络·网络协议