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下安装PHP

    安装准备 安装PHP所需的系统库,可以扩展php更多功能 手动安装libiconv-devel(编译三部曲) 默认yum源中缺少libiconv-devel软件包,需要编译安装,用于php的编码转换 下载安装 国内镜像地址:http://mirrors.sohu.com/php/ 下载编译文件 编译安装 配置编译脚本 看到如下提示,说明编译成功了 进行编译安…

    2022年6月25日
    1.6K00
  • /etc/security/limits.conf配置文件详解

    /etc/security/limits.conf 是一个用于配置用户或用户组资源限制的配置文件。这个文件通常用于设置系统资源的软限制和硬限制,以及一些特殊权限。 一. limits.conf常见配置项详解 下面是一些 /etc/security/limits.conf 文件中可能包含的常见配置项: 描述 第一列表示用户和组(@开头),这里的 * 代表所有用…

    2024年5月14日
    1.7K00
  • 手把手教你戴尔DELL 服务器 R410 带外管理iDRAC6 升级固件版本

    升级完R410的BIOS之后,第二个需求是更新远程管理的iDRAC版本。iDRAC需要服务器安装了远程管理卡才可以使用,然而一般现在网上买到的二手R410都是非常旧的iDRAC版本。(简单判断方法:管理页面是浅蓝色配色白底背景的是旧版本,新版本为深色背景) 和更新BIOS的问题相似,网上极少有关于服务器iDRAC更新的资料。且官方的文档说明也不全。经查阅整理…

    2024年1月22日
    2.7K00
  • MySQL 用户管理和权限管理

    在项目中,一个数据库有很多人需要使用,不能所有的人都使用相同的权限,如果人比较多,一人一个用户也很难管理。一般来说,会分超级管理员权限,管理员权限,读写权限,只读权限等,这样方便管理。当然,具体怎么管理权限根据实际情况来确定。无论如何,都需要创建多个用户来管理权限。root 是数据库的超级管理员用户,对于普通开发人员来说,权限太大了,如果不小心做了一些不可逆…

    2022年6月9日
    2.1K00
  • 如何在 Ubuntu 22.04 上启用 BBR?

    由于购买的VPS或者主机数据中心都在国外,经常会发生网络拥堵的情况,我们可以通过启用BBR来优化。 在Ubuntu系统上启用BBR可以提升网络连接速度,优化网络拥堵情况。 BBR代表瓶颈带宽,RTT是拥塞控制系统。 您可以在 Linux 桌面上启用 TCP BBR 以改善整体网上冲浪体验。 默认情况下,Linux 使用 Reno 和 CUBIC 拥塞控制算法…

    2024年3月12日
    2.3K00

发表回复

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

在线咨询: QQ交谈

邮件:712342017@qq.com

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

关注微信