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

相关推荐

  • Ubuntu修改静态IP、网关和DNS的方法总结

    /etc/netplan (use) Ubuntu 18.04开始可以使用netplan配置网络,其也是默认安装的。配置文件位于/etc/netplan/xxx.yaml中,netplan默认是使用NetworkManager来配置网卡信息的。 使用 netplan apply 网络配置 Ubuntu /etc/network/interfaces 修改静态…

    2023年11月27日
    1.2K00
  • 七牛云对象存储使用 qshell 批量管理文件存储类型(实战教程)

    七牛云对象存储使用 qshell 批量管理文件存储类型(实战教程) 一、适用场景说明 本教程适用于以下典型场景: 二、前置条件 1️⃣ 准备 qshell 下载地址:https://github.com/qiniu/qshell/releases 确认版本(建议记录): 2️⃣ 七牛云 AccessKey / SecretKey 确保账号具备以下权限(至少)…

    2025年12月19日
    13500
  • NetSet – 自动化网络流量安全增强工具

    NetSet旨在自动执行多个操作,以帮助用户保护网络流量。它还提供了一种通过Tor收集代理和运行实用程序的简便方法。NetSet安装和使用的也是自动配置,该工具主要用于辅助性网络安全任务。 实现了一种按需使用的终端多路复用器,它的会话通过Tor路由网关。通过自动安装和配置DNSCrypt-proxy来保护DNS流量。Tor Wall功能强制所有流量通过Tor…

    2023年10月8日
    1.4K00
  • Linux——手把手教你解决sudo指令无法使用的问题

    解决sudo指令无法使用的问题 1. 为什么不能使用 sudo指令能够使某一条指令拥有root权限,即以root权限去执行 例如 sudo ls -l 但是,如果是新创建的普通账户,一般来说一开始是不能执行sudo命令的: 根据提示,LQF这一用户并不在sudoers这个文件中,因此没有使用sudo的权利suduers文件位于路径/etc/sudoerssu…

    2024年5月31日
    1.4K00
  • Docker安装部署Redis数据库

    通过Docker部署Redis,比起我们自己编译安装的方式,会更加方便容易管理。今天就来简单分享一下使用Docker部署Redis数据库。 1,拉取镜像 通过下列命令: 2,创建数据卷 通常,类似于MySQL,Redis作为数据库,我们最好还是需要将其配置和数据等等挂载到数据卷以持久化到宿主机。 仍然是使用具名挂载的方式方便管理。 这样就创建了两个数据卷分别…

    2023年1月11日
    1.1K00

发表回复

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

在线咨询: QQ交谈

邮件:712342017@qq.com

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

关注微信