很多朋友可能发现了,以前在CentOS6的机器上用yum安装软件是正常的,最近却不能用了。一般会报如下错误:[root@665daec6fea1~]#yuminstallaprLoadedplugins:fastestmirror,ovlSettingupInstallProcessLoadingmirrorspeedsfromcachedhostfileYumRepoError:AllmirrorURLsarenotusingftp,http[s]orfile.例如。Invalidrelease/repo/archcombination/removingmirrorlistwithnovalidmirrors:/var/cache/yum/x86_64/6/base/mirrorlist.txtError:Cannotfindavalidbaseurlforrepo:base使用yum更新同样如此命令:[root@665daec6fea1~]#yumupdateLoadedplugins:fastestmirror,ovlSettingupUpdateProcessLoadingmirrorspeedsfromcachedhostfileYumRepoError:AllmirrorURLsarenotusingftp,http[s]orfile.例如。Invalidrelease/repo/archwithcombinationmirrorlistnovalidmirrors:/var/cache/yum/x86_64/6/base/mirrorlist.txtError:Cannotfindavalidbaseurlforrepo:base查看错误信息,似乎是有效的找不到baseurl。所以要解决这个问题,我们需要从baseurl入手。根据官方邮件,自2020年11月30日起,CentOS6将不再进行官方维护,因此连原来的yum仓库都无法使用。但是邮件里写的很清楚,给出了迁移后的仓库的链接地址。这个时候我们只需要更新一下yum仓库的镜像列表,就可以正常使用了。步骤如下:进入/etc/yum.repos.d目录:cd/etc/yum.repos.d备份原来的CentOS-Base.repo文件:cpCentOS-Base.repoCentOS-Base.repo.old修改CentOS-Base.repo文件:viCentOS-Base.repo主要修改如下:[base]name=CentOS-$releasever-Base#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/baseurl=https://vault.centos.org/6.10/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#发布更新[updates]name=CentOS-$releasever-Updates#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/baseurl=https://vault.centos.org/6.10/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#可能有用的附加组件[extras]name=CentOS-$releasever-Extras#mirrorlist=http://镜像列表。centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/baseurl=https://vault.centos。org/6.10/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6清理yum包存yumcleanall执行yumupdateyumupdate再次安装成功:[root@665daec6fea1~]#yuminstallaprLoadedplugins:fastestmirror,ovlSettingupInstallProcessLoadingmirrorspeedsfromcachedhostfileYumRepo错误:所有镜像URL都没有使用ftp、http[s]或文件。例如。无效的发布/repo/arch组合/YumRepo错误:所有镜像URL都没有使用ftp、http[s]或文件。例如。无效的发布/repo/arch组合/YumRepo错误:所有镜像URL都没有使用ftp、http[s]或文件。例如。无效的release/repo/arch组合/ResolvingDependencies-->Runningtransactioncheck--->Packageapr.x86_640:1.3.9-5.el6_9.1willbeinstalled-->FinishedDependencyResolutionDependenciesResolved==============================================================================================================包Arch版本存储库大小==============================================================================================================安装:aprx86_641.3.9-5.el6_9.1base124kTransactionSummary============================================================================================================安装1个包总下载大小:124kInstalled大小:296kIsthisok[y/N]:yDownloadingPackages:apr-1.3.9-5.el6_9.1.x86_64。转数|124kB00:00运行rpm_check_debugRunning事务测试事务测试成功运行事务安装:apr-1.3.9-5.el6_9.1.x86_641/1/sbin/ldconfig:/usr/lib/libcriterion.so.3不是符号链接/sbin/ldconfig:/usr/lib64/libcriterion.so.3不是符号链接正在验证:apr-1.3.9-5.el6_9.1.x86_641/1安装:apr.x86_640:1.3.9-5.el6_9.1完成!到目前为止,你已经完成了
