解决CentOS 7停止更新支持后yum源失效的问题 脚本命令

V 智南  (UID: 1) 创始人 3月前 [复制链接]
帖子链接已复制到剪贴板

636 0

近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
 
php

或者:

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
 
markup

解决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
 
markup
熬夜不好,建议通宵~
已有回复 (0)
未登录, 登录后可查看回复!
Xiuno插件网 大圣云-海外VPS 码易付-免签约即时到账
发新帖
推广 (站长QQ:9321856)
Xiuno插件网
大圣云-海外VPS
码易付-免签约即时到账