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

Contos7yum停服

CentOS 7在2024年6月30日停止了维护,这意味着官方不再为该版本提供安全更新、软件更新和bug修复。

当CentOS停服或官方yum源无法访问时,用户可能会遇到无法安装软件包、更新系统或解决依赖关系的问题。以下是一些解决方案:

  1. 更换yum源

o 用户可以将yum源更改为第三方提供的镜像源,这些镜像源通常会继续提供对旧版CentOS的支持。例如,可以选择华为云、阿里云等提供的CentOS镜像仓库。

o 更改yum源的方法通常涉及下载新的CentOS-Base.repo文件到/etc/yum.repos.d/目录下,并替换原有的文件。然后执行yum clean all和yum makecache命令来清除缓存并刷新元数据。

2.使用第三方仓库

o 除了更换官方的yum源外,用户还可以考虑使用如EPEL(Extra Packages for Enterprise Linux)等第三方仓库来获取额外的软件包和更新。

  1. 升级操作系统

o 如果可能的话,升级到CentOS的更高版本或迁移到另一个受支持的操作系统可能是解决停服问题的长期解决方案。

4.手动安装软件包

o 对于无法通过yum安装的软件包,用户可以尝试从软件包的官方网站或第三方源手动下载并安装。

  1. 使用Docker等容器技术

o 对于特定的应用程序或服务,用户可以考虑使用Docker等容器技术来避免直接依赖于操作系统的软件包管理器。

6.联系上游

o 如果用户依赖于特定的软件包或仓库,并且该软件包或仓库的维护者仍在继续支持,可以联系上游以获取帮助或寻找替代方案。

需要注意的是,由于CentOS停服后官方不再提供支持和更新,因此使用旧版本的CentOS可能会面临安全风险。因此,建议用户尽快迁移到受支持的操作系统版本或采取其他适当的措施来保护其系统和数据的安全。

如下操作:

执行yum命令后,错误如下所示。

[hadoop@hadoop ~]$ sudo yum install net-tools
[sudo] password for hadoop: 
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Name or service not known"One of the configured repositories failed (Unknown),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=<repoid> ...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 <repoid>orsubscription-manager repos --disable=<repoid>5. 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=<repoid>.skip_if_unavailable=trueCannot find a valid baseurl for repo: base/7/x86_64

错误处理:

1.错误排查

  1. 检查网络是否正常(ping外网)

  2. resolv.conf中手动配置检查一下NDS

  3. ip route检查路由发现没问题

  4. 关闭防火墙也没法解决问题

    以上都问题那么就是我们的配置的yum源出现了问题,那么我们只需要更换yum源即可。

2.更换yum源

1.备份当前的yum源配置文件

[hadoop@hadoop yum.repos.d]$ pwd
/etc/yum.repos.d
[hadoop@hadoop yum.repos.d]$ sudo cp CentOS-Base.repo CentOS-Base.repo.backup

2.删除或注释掉旧的.repo文件

[hadoop@hadoop yum.repos.d]$ sudo rm -rf CentOS-Base.repo

3.创建一个新的.repo文件

[hadoop@hadoop yum.repos.d]$ sudo vi CentOS-Base.repo

4.在新的.repo文件中,添加如下内容(以阿里云为例)

在**/etc/yum.repos.d/CentOS-Base.repo**文件中添加如下内容

[base]
name=CentOS-$releasever - Base - Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#released updates 
[updates]
name=CentOS-$releasever - Updates - Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

5.保存文件后,运行如下命令清除缓存并更新缓存

[hadoop@hadoop yum.repos.d]$ sudo yum clean all
[hadoop@hadoop yum.repos.d]$ sudo yum makecache

6.验证,安装yum

[hadoop@hadoop yum.repos.d]$ sudo yum -y install vim

相关文章:

  • spider分享--图片
  • 时间同步技术在电力系统中的应用二
  • 讲一件Java虚拟线程
  • 英一真题阅读单词笔记 09年
  • 第三章支线六 ·数据幻域 · 状态管理与数据流
  • 面向异构系统的多面体编译优化关键技术研究——李颖颖博士
  • 2025武汉考研形势分析,趋势、挑战与应对策略
  • 【实习总结】C++ 通过pugi::xml库对xml文件进行操作
  • Spring Boot + MyBatis Plus 项目中,entity和 XML 映射文件的查找机制
  • CSS“多列布局”
  • 从代码学习深度强学习 - Dyna-Q 算法 PyTorch版
  • SnapViewer:解决PyTorch官方内存工具卡死问题,实现高效可视化
  • 一站式了解单例模式
  • 每天五分钟深度学习PyTorch:卷积和池化后图片会有什么变化?
  • 【Rust UDP编程】rust udp编程方法解析与应用实战
  • 【凌智视觉模块】rv1106 部署 ppocrv4 检测模型 rknn 推理
  • 行为模式-责任链模式
  • 宁德时代电解液创新研究荣登《自然》顶刊,案例解析电解液成分分析方法
  • Oracle 的AHF (Automatic Health Framework) 工具
  • ElasticSearch 操作索引与映射的API
  • 网站的百度百科怎么做/广东网络推广运营
  • 开发网站开始的工作/珠海百度关键字优化
  • 做网站界面多少钱/网络广告营销经典案例
  • 网站兼容性测试怎么做/优化师培训机构
  • 做博物馆网站最重要性/青山seo排名公司
  • 做外卖骑手用哪个网站/seo优化必备技巧