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 DNS覆盖写入127.0.0.53

    问题: ubuntu22.04解析网址时报错如图所示: 因为/etc/resolve.conf中存在 nameserver 127.0.0.53回环地址造成循环引用 原因: ubuntu17.0之后特有,systemd-resolvd服务会一直覆盖 解决方法: 1、修改resolv.config文件中的nameserver(选做),修改完后DNS解析就能恢复…

    2022年12月1日
    3.4K00
  • Linux下安装PHP

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

    2022年6月25日
    1.2K00
  • CentOS7搭建LNMP环境教程

    一、安装nginx 创建 nginx.repo 文件 安装配置nginx 配置文件详解 启动并验证 二、安装MariaDB 安装mariadb 使用Mysql需先初始化密码 三、安装PHP 更新yum源 执行下面的命令安装所需的包 启动php-fpm 创建测试文件 访问服务器,如果出现如下界面表示安装完成! 这样Lnmp环境就快速搭建完成了!!!

    2022年11月15日
    1.3K00
  • 迁移到新服务器上的PHP网站,使用浏览器访问时提示“不支持MySQL”等信息,如何处理?

    问题描述 PHP网站(该网站需使用PHP执行程序代码)迁移到新服务器后,在使用浏览器访问时提示如下任意一种信息。 问题原因 因为MySQL扩展功能自PHP 5.5.0版本开始被废弃,并且从PHP 7.0.0版本开始被移除,当网站迁移到新服务器时一般会迁移到PHP 7.0.0及以上版本,由于网站迁移后的新服务器的PHP版本过高,网站程序无法再连接MySQL,导…

    2023年11月17日
    1.1K00
  • CentOS安装noVNC,以Web方式交付VNC远程连接

    什么是noVNC noVNC 是一个 HTML5 VNC 客户端,采用 HTML 5 WebSockets, Canvas 和 JavaScript 实现,noVNC 被普遍用在各大云计算、虚拟机控制面板中,比如 OpenStack Dashboard 和 OpenNebula Sunstone 都用的是 noVNC。 noVNC 采用 WebSockets…

    2024年5月8日
    1.3K00

发表回复

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

在线咨询: QQ交谈

邮件:712342017@qq.com

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

关注微信