CentOS 7/8停止更新支持后yum源失效解決方案
linux教程
2024-07-22 22:54
4607
最近CentOS 7已經(jīng)停止更新支持,同時官方也把yum源刪除了,目前CentOS 7系統(tǒng)使用yum命令安裝軟件包提示“Could not resolve host: mirrorlist.centos.org; Unknown error”,因此需要更換yum源。
在ssh界面執(zhí)行以下命令即可更換yum源為CentOS的Vault源(包括CentOS官方和阿里云的源):
wget -O /etc/yum.repos.d/CentOS-Base.repo http://file.kangle.cccyun.cn/repo/Centos-7.repo
yum makecache
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://file.kangle.cccyun.cn/repo/Centos-7.repo
yum makecache
解決CentOS Stream 8停止更新后無法使用yum命令。
在ssh界面執(zhí)行以下命令即可更換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