centos 7 更换为阿里云yum源
Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64
报错解释:这个错误表明系统无法为名为 "centos-sclo-rh" 的软件集合仓库找到有效的基础URL。这通常发生在CentOS系统上,当系统尝试使用已经停止支持的软件仓库时。
问题原因:Centos 7版本已经于2024/6/30结束了官方支持。
解决办法:
cd /etc/yum.repos.d/ mv CentOS-SCLo-scl.repo CentOS-SCLo-scl.repo.bak mv CentOS-SCLo-scl-rh.repo CentOS-SCLo-scl-rh.repo.bak
# vim CentOS-SCLo-rh.repo
[centos-sclo-rh] name=CentOS-7 - SCLo rh baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
=======更新CentOS-Base.repo文件====================
[base] name=CentOS-$releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/ http://mirrors.cloud.aliyuncs.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 - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/ http://mirrors.cloud.aliyuncs.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 - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/ http://mirrors.cloud.aliyuncs.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 - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
============常见报错问题=============
mv /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo.bak vim /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
粘贴以下内容:
-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v2.0.22 (GNU/Linux) mQENBFYM/AoBCADR9Q5cb+H5ndx+QkzNBQ88wcD+g112yvnHNlSiBMOnNEGHuKPJ tujZ+eWXP3K6ucJckT91WxfQ2fxPr9jQ0xpZytcHcZdTfn3vKL9+OwR0npp+qmcz rK8/EzVz/SWSgBQ5xT/HUvaeoVAbzBHSng0r2njnBAqABKAoTxgyRGKSCWduKD32 7PF2ZpqeDFFhd99Ykt6ar8SlV8ToqH6F7An0ILeejINVbHUxd6+wsbpcOwQ4mGAa /CPXeqqLGj62ASBv36xQr34hlN/9zQMViaKkacl8zkuvwhuHf4b4VlGVCe6VILpQ 8ytKMV/lcg7YpMfRq4KVWBjCwkvk6zg6KxaHABEBAAG0aENlbnRPUyBTb2Z0d2Fy ZUNvbGxlY3Rpb25zIFNJRyAoaHR0cHM6Ly93aWtpLmNlbnRvcy5vcmcvU3BlY2lh bEludGVyZXN0R3JvdXAvU0NMbykgPHNlY3VyaXR5QGNlbnRvcy5vcmc+iQE5BBMB CgAjAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AFAmIgbg0ACgkQTrhOcfLu nVUzkAgAgJSl++PWo69OGI8eUn53whhfJ6ZyKCOyI9+Flghtfwq1mdcP4dIoAubw nlQcvEsE4Erob2I1S+n/dXYh9y2+Si3HdXRreKzC1rCSG5ebYRrEqeMoJhBoDFSd xydtxi03l+Dh2iWtLtXpAM85qHvgIrPfdUnLRVbDBT52Ph5igZl8ux2ooJ94CPm4 yTG/0aPIebNQsLP8LEpa2wad2WJfIeFgjEHranWIzhzapGgwyf2Iu9Sz3L8ljiz2 2HixHpI2es3IqgLyRsTBo2/EdbvMJWlFwiESe1UQIW6ObKNnVabIHUAxZgOlj59o JhPOzTBG+Ma2fLs+ZFBV88cpKdctFQ== =+Gr2 -----END PGP PUBLIC KEY BLOCK-----
yum-config-manager --enable centos-sclo-rh yum-config-manager --enable centos-sclo-sclo yum clean all yum makecache
征途漫漫,惟有奋斗!