当尝试在 Centos6 上使用
yum update
时,我收到此错误:“错误:无法找到存储库的有效基本 URL:centos-sclo-rh。”
有什么办法可以摆脱这种错误情况吗?
[root@4206-yv3 ~]$ yum update
Loaded plugins: fastestmirror
Setting up Update Process
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=6&repo=sclo-rh error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: centos-sclo-rh
[root@4206-yv3 ~]$
你可以试试这个。
echo "https://vault.centos.org/6.10/os/x86_64/" > /var/cache/yum/x86_64/6/base/mirrorlist.txt
echo "http://vault.centos.org/6.10/extras/x86_64/" > /var/cache/yum/x86_64/6/extras/mirrorlist.txt
echo "http://vault.centos.org/6.10/updates/x86_64/" > /var/cache/yum/x86_64/6/updates/mirrorlist.txt
echo "http://vault.centos.org/6.10/sclo/x86_64/rh" > /var/cache/yum/x86_64/6/centos-sclo-rh/mirrorlist.txt
echo "http://vault.centos.org/6.10/sclo/x86_64/sclo" > /var/cache/yum/x86_64/6/centos-sclo-sclo/mirrorlist.txt
因为 centos6 已经 EOL,对于 centos-sclo-rh ,将以下内容添加到 CentOS-Base.repo
[centos-sclo-rh]
name=CentOS-6.10 - SCLo rh
baseurl=http://vault.centos.org/centos/6.10/sclo/$basearch/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo]
name=CentOS-6.10 - SCLo sclo
baseurl=http://vault.centos.org/centos/6.10/sclo/$basearch/sclo/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
由于我们谈论的是已经 EOL 的 CentOS6,所以这是意料之中的事情。如果您不想担心使用
yum clean all
,请导航至 /etc/yum.repos.d/ 并调整 CentOS-Base.repo 中的条目。
您需要注释掉以“mirrorlist=”开头的所有行,并取消注释以“baseurl=”开头的行。
接下来是编辑“baseurl”行上的网址 - 将所有“mirror.centos.org”条目切换为“vault.centos.org”。例如,编辑后第一个块应该看起来像这样:
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
我不需要 SCL,所以我删除了
/etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
,这解决了问题。
你可以尝试:
yum-config-manager --disable centos-sclo-sclo/x86_64
或
yum-config-manager --disable centos-sclo-rh/x86_64
Centos6的解决方案修改为Centos7:
[centos-sclo-rh]
name=CentOS-7.9.2009 - SCLo rh
baseurl=https://vault.centos.org/7.9.2009/sclo/$basearch/rh/
gpgcheck=0
enabled=1
[centos-sclo-sclo]
name=CentOS-7.9.2009 - SCLo sclo
baseurl=https://vault.centos.org/7.9.2009/sclo/$basearch/sclo/
gpgcheck=0
enabled=1