当前位置: 首页 > news >正文

【解决】CentOS7 生命周期结束后 使用 yum命令报错问题

前言

天翼云服务器安装 centos7.9 使用yum命令报错,使用yum命令,报错信息如下:

[root@ecm-491c mysql-8.0.34]# yum -y update
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                    | 5.1 kB  00:00:00     * epel: ftp-stud.hs-esslingen.de
https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
正在尝试其它镜像。
To address this issue please refer to the below wiki article https://wiki.centos.org/yum-errorsIf above article doesn't help to resolve this issue please use https://bugs.centos.org/.One of the configured repositories failed (CentOS-7 - Base),and yum doesn't have enough cached data to continue. At this point the onlysafe thing yum can do is fail. There are a few ways to work "fix" this:1. Contact the upstream for the repository and get them to fix the problem.2. Reconfigure the baseurl/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=base ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable baseorsubscription-manager repos --disable=base5. Configure the failing repository to be skipped, if it is unavailable.Note that yum will try to contact the repo. when it runs most commands,so will have to try and fail each time (and thus. yum will be be muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=base.skip_if_unavailable=truefailure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

问题原因

centos72024年6月30日,生命周期结束,官方不再进行支持维护,官方的YUM源也下线了,下线的方式是使yum的域名不解析。所以现在需要配置国内的YUM源。

解决办法

1. 编辑 CentOS-Base.repo

sudo vim /etc/yum.repos.d/CentOS-Base.repo

2. 将下文信息替换原有内容

[base]  
name=CentOS-$releasever - Base  
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  #released updates   
[updates]  
name=CentOS-$releasever - Updates  
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  #additional packages that may be useful  
[extras]  
name=CentOS-$releasever - Extras  
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  #additional packages that extend functionality of existing packages  
[centosplus]  
name=CentOS-$releasever - Plus  
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  #contrib - packages by Centos Users  
[contrib]  
name=CentOS-$releasever - Contrib  
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/contrib/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  # 使用failovermethod指定优先级,这里设置为随机(roundrobin),也可以改为priority并指定每个URL的优先级  
failovermethod=roundrobin

3. 清理YUM缓存并更新

sudo yum clean all
sudo yum makecache
sudo yum update


http://www.mrgr.cn/news/17236.html

相关文章:

  • 【面试经验】京东-数据产品面经(一面)
  • 【深海王国】初中生也能玩的建模与3D打印?SolidWorks带你走进3D打印的神奇之旅(1.5)
  • 驱动(RK3588S)第四课时:模块化编程
  • Java-数据结构-ArrayList-练习 ψ(*`ー´)ψ
  • C++系列-STL容器之list
  • 4-8 进入C语言,并跳转到loarder(1)
  • 手把手带你实现C语言扫雷进阶(1)(接上回基础版扫雷,附上源码)
  • 第十七篇——九变篇:紧扣战略重心,别跑题
  • 【计算机组成原理】七、输入/输出系统:1.I/O基本概念、I/O设备(外部设备)
  • 【iOS】通过第三方库Masonry实现自动布局
  • 总结之Coze 是一站式 AI Bot 开发平台——使用coze(一)
  • Spring Bean 作用域
  • Docker简介及部署方法
  • ★ 算法OJ题 ★ 力扣15 - 三数之和
  • BP神经网络学习内容分享:前向传播与后向传播
  • watchdog: BUG: soft lockup
  • 概率论与数理统计
  • TCP的流量控制深入理解
  • C语言程序设计之基础易错题锦集6
  • 百度 AI Studio 脚本任务篇,它不同于notebook任务是支持免费的, 脚本任务是需要算力卡的,更好的算力 支持四张显卡,