当前位置: 首页 > 各类教程 > 正文

解决CentOS 7停止更新支持后yum源失效

消失的彩虹海 发表于2024年7月5日 21:35

最近CentOS 7已经停止更新支持,同时官方也把yum源删除了,目前CentOS 7系统使用yum命令安装软件包提示“Could not resolve host: mirrorlist.centos.org; Unknown error”,因此需要更换yum源。

在ssh界面执行以下命令即可更换yum源为CentOS的Vault源(包括CentOS官方和阿里云的源):

wget -O /etc/yum.repos.d/CentOS-Base.repo http://file.kangle.cccyun.cn/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://file.kangle.cccyun.cn/repo/epel-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://file.kangle.cccyun.cn/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://file.kangle.cccyun.cn/repo/epel-7.repo


解决CentOS Stream 8停止更新后无法使用yum命令。

在ssh界面执行以下命令即可更换yum源为CentOS的Vault源:


sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo


全文完
本文标签:
本文标题: 解决CentOS 7停止更新支持后yum源失效
本文链接: http://blog.cccyun.cn/m/?post=530

〓 随机文章推荐

共有2098阅 / 4我要评论
  1. @转转:不会
  2. 转转地板
    会丢失数据吗?
  3. 菜菜板凳
    来了
  4. 表弟沙发
    历时一个半月后表哥博客可算更新了。每次都能带来刚需的文章!支持一下。

发表你的评论吧返回顶部

!评论内容需包含中文

请勾选本项再提交评论