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

相关推荐

  • rsync+sersync实现实时监控备份同步

    rsync+sersync简介 sersync是基于inotify开发的,类似于inotify-tools的工具。所以同样内核需先支持inotify,才能搭建。 sersync可以记录下被监听目录中发生变化的(包括增加、删除、修改)具体某一个文件或者某一个目录的名字,然后使用rsync同步的时候,只同步发生变化的文件或者目录。 搭建环境:2台Linux(ce…

    2023年3月29日
    80800
  • NetSet – 自动化网络流量安全增强工具

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

    2023年10月8日
    86700
  • 在 Kubernetes 上最小化安装 KubeSphere

    除了在 Linux 机器上安装 KubeSphere 之外,您还可以将其直接部署在现有的 Kubernetes 集群上。本快速入门指南将引导您完成在 Kubernetes 上最小化安装 KubeSphere 的一般性步骤。 准备工作 备注 部署 KubeSphere 确保您的机器满足安装的前提条件之后,可以按照以下步骤安装 KubeSphere。 执行以下命…

    2023年4月18日
    68600
  • Centos7忘记root密码怎么办

    重启linux,进入系统的GRUB菜单界面,选择最下方的,按下小写字母e进入编辑界面 按下方向键,找到以字符串Linux16开头的行,光标移动到结尾,然后输入init=/bin/bash enforcing=0 代表登录系统后,加载bash解释器,然后关闭selinux 按下ctrl+x组合键以单用户模式启动Linux 输入如下命令,重新挂载根目录,进入可写…

    2022年6月11日
    92900
  • 如何升级ESXi补丁?

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

    2023年2月4日
    99600

发表回复

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

在线咨询: QQ交谈

邮件:712342017@qq.com

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

关注微信