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

相关推荐

  • 使用openssl创建自签发SSL证书

    使用openssl创建自签发SSL证书 生成根证书 生成ca秘钥,得到ca.key openssl genrsa -out ca.key 4096 生成ca证书签发请求,得到ca.csr openssl req -new -key ca.key -out ca.csr -subj “/C=CN/ST=JS/L=NanJing/O=other/OU=other…

    2023年1月31日
    92800
  • Centos7下FTP安装与配置

    一、前述 企业中linux搭建ftp服务器还是很实用的,所以本文基于Centos7搭建服务器教程做个总结。 FTP协议占用两个端口号: 21端口:命令控制,用于接收客户端执行的FTP命令。 20端口:数据传输,用于上传、下载文件数据。 二、服务端安装 1.安装vsftpd yum -y install vsftpd 2.配置vsftp vim /etc/vs…

    2022年6月15日
    1.4K00
  • Docker搭建phpipam管理平台

    phpipam功能很多,但最直接的都是用来做IP地址管理工具。在IT管理中,IP地址的分配和使用是比较重要的一环,尤其是对于全网中子网地址的分配,以及个别Server地址分配,静态地址使用记录等。 这里按照参考通过docker方式,下载镜像并运行容器,可以很容易搭建并应用。phpipam采用mysql数据库来储存数据,对应容器来说,在运行时可以将其数据目录映…

    2022年12月1日
    1.7K00
  • ubuntu20.04 删除linux中软raid的方法

    取消软件 RAID 可能涉及到几个步骤,具体取决于你的操作系统和使用的软件。在大多数 Linux 系统中,mdadm 是用于管理软件 RAID 的常见工具。以下是在 Linux 中取消软件 RAID 的一般步骤: 请注意:在执行这些步骤之前,请确保你已经备份了所有重要数据,因为取消 RAID 可能会导致数据丢失。 查看当前 RAID 状态: 使用以下命令查看…

    2023年11月24日
    1.5K00
  • linux手误rm后恢复文件

    误删文件还原可以分为两种情况 今天只分析文件被删除后,相关进程还存在的情况 这种一般是有活动的进程存在持续标准输入或输出,到时文件被删除后,进程PID依旧存在。这也是有些服务器删除一些文件但是磁盘不释放的原因 案例演示 创建一个文件 用tail -f打开rumenz.txt文件 目的是让rumenz.txt被删除后,进程依然存在 新开一个终端删除rumenz…

    2023年10月17日
    1.9K00

发表回复

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

在线咨询: QQ交谈

邮件:712342017@qq.com

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

关注微信