很多小伙伴可能发现了,以前在 CentOS 6
的机器上应用yum
装置软件还是失常的,可是最近却无奈应用了。个别都会报上面这样的谬误:
[root@665daec6fea1 ~]# yum install apr
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
应用 yum update
命令也是一样:
[root@665daec6fea1 ~]# yum update
Loaded plugins: fastestmirror, ovl
Setting up Update Process
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
看谬误提醒,仿佛是说找不到无效的 baseurl
。所以要解决这个问题,还要从baseurl
着手。
从官网邮件可知,CentOS 6
自从 2020 年 11 月 30 日开始,官网不再保护,所以连带着原来的 yum
存储库也不能用了。
然而邮件里说得很明确,它给出了迁徙后的存储库的链接地址,这时候咱们只须要更新 yum
存储库的镜像列表,就能够失常应用了。
步骤如下:
进入到 /etc/yum.repos.d
目录下:
cd /etc/yum.repos.d
备份原来的 CentOS-Base.repo 文件:
cp CentOS-Base.repo CentOS-Base.repo.old
批改 CentOS-Base.repo 文件:
vi CentOS-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=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# released updates
[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=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.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=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
清理yum
缓存
yum clean all
执行 yum update
yum update
再次装置胜利:
[root@665daec6fea1 ~]# yum install apr
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
Resolving Dependencies
--> Running transaction check
---> Package apr.x86_64 0:1.3.9-5.el6_9.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================
Package Arch Version Repository Size
================================================================================================================
Installing:
apr x86_64 1.3.9-5.el6_9.1 base 124 k
Transaction Summary
================================================================================================================
Install 1 Package(s)
Total download size: 124 k
Installed size: 296 k
Is this ok [y/N]: y
Downloading Packages:
apr-1.3.9-5.el6_9.1.x86_64.rpm | 124 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : apr-1.3.9-5.el6_9.1.x86_64 1/1
/sbin/ldconfig: /usr/lib/libcriterion.so.3 is not a symbolic link
/sbin/ldconfig: /usr/lib64/libcriterion.so.3 is not a symbolic link
Verifying : apr-1.3.9-5.el6_9.1.x86_64 1/1
Installed:
apr.x86_64 0:1.3.9-5.el6_9.1
Complete!
至此,功败垂成。