CentOS 6 yum安装软件报错 YumRepo Error

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!

至此,大功告成。

文章来源:https://www.cnaaa.net,转载请注明出处:https://www.cnaaa.net/archives/8236

(0)
郭靖的头像郭靖
上一篇 2023年5月24日 下午4:57
下一篇 2023年5月25日 下午5:18

相关推荐

  • Linux实验案例:构建DHCP服务器

    公司要求将闲置的一台Linux主机配置为DHCP服务器,以便为局域网内员工的办公用机提供自动分配IP地址服务,提高网络管理和维护的效率。 需求描述 给局域网内各主机自动分配的IP地址范围为192.168.10.20~192.168.10.30 局域网内各主机使用的默认网关地址为192.168.10.2 局域网内各主机使用的DNS服务器地址分别为202.96.…

    2024年6月24日
    1.1K00
  • Linux 图片批量压缩工具 ImageMagick

    一个比较好用命令行下可以使用的,强大的免费图片工具 ImageMagick. 安装完成。

    2022年7月28日
    1.4K00
  • 如何升级ESXi补丁?

    由于VMware近期针对虚拟机逃逸漏洞发行了补丁,最近很多客户都在更新ESXi补丁,借此机会写一个升级补丁文档,如何升级ESXi补丁? 一、登录Vmware官网下载最新的补丁包: 下载地址:https://my.vmware.com/cn/group/vmware/patch#search 下载日期最新的那个ESXi670-202011002.zip。该补丁…

    2023年2月4日
    97200
  • GLIBC修复笔记,学会这些让你更快的解决系统问题

    公司环境有台机器硬盘故障,需要安装Megacli工具进系统查看raid信息,在Ubuntu20.04安装Megacli解决依赖过程中失误将高版本的libtinfo包装系统上了,导致系统报Glibc对应的版本没有找到,系统实际Glibc的版本是2.31。 背景 公司环境有台机器硬盘故障,需要安装megacli工具进系统查看raid信息,在ubuntu20.04…

    2023年12月7日
    61500
  • Ubuntu系统如何配置镜像源

    我们在使用Linux系统时,一般来说都是需要配置一个源地址才能直接使用下载的命令来安装软件的,若你购买的是云服务器,正常来讲是服务器厂商配置好了源的,但是也不缺乏有少量的机器源会出现问题,导致安装软件不成功,如下图所示,那么我们就需要手动去配置了 第一步:替换原有的源 第二步:安装证书 如果安装失败,重新安装即可

    2022年6月14日
    1.1K00

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

在线咨询: QQ交谈

邮件:712342017@qq.com

工作时间:周一至周五,8:30-17:30,节假日休息

关注微信