执行yum install 失败

想安装:

[root@localhost ~]# yum install lrzsz
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

RHEL9-BaseOS                                                                                                                                                                                                                        0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'RHEL9-BaseOS':
  - Curl error (37): Couldn't read a file:// file for file:///media/cdrom/BaseOS/repodata/repomd.xml [Couldn't open file /media/cdrom/BaseOS/repodata/repomd.xml]
错误:为仓库 'RHEL9-BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost ~]# 
[root@localhost ~]# sz
bash: sz: command not found...
Similar command is: 'ss'
[root@localhost ~]# yum update 
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

RHEL9-BaseOS                                                                                                                                                                                                                        0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'RHEL9-BaseOS':
  - Curl error (37): Couldn't read a file:// file for file:///media/cdrom/BaseOS/repodata/repomd.xml [Couldn't open file /media/cdrom/BaseOS/repodata/repomd.xml]
错误:为仓库 'RHEL9-BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost ~]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo1
cp: 无法获取'/etc/yum.repos.d/CentOS-Base.repo' 的文件状态(stat): 没有那个文件或目录
[root@localhost ~]# ll /etc/yum.repos.d/

发现总是报错。

难道需要切换源?

[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
 

[root@localhost ~]# wget -O CentOS-LinuxBaseOS.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
 

[root@localhost yum.repos.d]# yum makecache
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
CentOS-8.5.2111 - Base - mirrors.aliyun.com                                                                                                                                                                                          61 kB/s | 3.9 kB     00:00    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                                                                                                                                                                        29 kB/s | 1.5 kB     00:00    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com                                                                                                                                                                                     61 kB/s | 4.3 kB     00:00    
RHEL9-BaseOS                                                                                                                                                                                                                        0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'RHEL9-BaseOS':
  - Curl error (37): Couldn't read a file:// file for file:///media/cdrom/BaseOS/repodata/repomd.xml [Couldn't open file /media/cdrom/BaseOS/repodata/repomd.xml]
错误:为仓库 'RHEL9-BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost yum.repos.d]# ll
总用量 16
-rw-r--r--. 1 root root 2495  8月  4  2022 CentOS-Base.repo
-rw-r--r--. 1 root root 2495  8月  4  2022 CentOS-LinuxBaseOS.repo
-rw-r--r--. 1 root root  358  4月 24  2023 redhat.repo
-rw-r--r--. 1 root root  369  4月 24  2023 rhel8.repo
[root@localhost yum.repos.d]# grep RHEL9-BaseOS *
rhel8.repo:[RHEL9-BaseOS]
rhel8.repo:name=RHEL9-BaseOS
[root@localhost yum.repos.d]# yum install lszrz
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
RHEL9-BaseOS                                                                                                                                                                                                                        0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'RHEL9-BaseOS':
  - Curl error (37): Couldn't read a file:// file for file:///media/cdrom/BaseOS/repodata/repomd.xml [Couldn't open file /media/cdrom/BaseOS/repodata/repomd.xml]
错误:为仓库 'RHEL9-BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost yum.repos.d]# yum install lrzsz
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
RHEL9-BaseOS                                                                                                                                                                                                                        0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'RHEL9-BaseOS':
  - Curl error (37): Couldn't read a file:// file for file:///media/cdrom/BaseOS/repodata/repomd.xml [Couldn't open file /media/cdrom/BaseOS/repodata/repomd.xml]
错误:为仓库 'RHEL9-BaseOS' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# less  rhel8.repo 
"rhel8.repo" may be a binary file.  See it anyway? 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# mv  rhel8.repo  rhel8.repo.bk
[root@localhost yum.repos.d]# yum install lrzsz
 

搞定。

原来, 就是 rhel8.repo 的原因。 其内容如下:

[root@localhost yum.repos.d]# cat rhel8.repo 
[RHEL9-BaseOS]

name=RHEL9-BaseOS

baseurl=file:///media/cdrom/BaseOS

gpgcheck=0

#gpgcheck=1 #如果gpgcheck为1,需要写秘钥文件路径

#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial

[RHEL9-Appstream]

name=RHEL9-Appstream

baseurl=file:///media/cdrom/AppStream

gpgcheck=0

#gpgcheck=1

#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial

可见, 他不是网络源, 而是本地镜像源。 所以。。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Linux系统中,`yum install -y yum-utils`命令是用来安装`yum-utils`工具包的,`yum`是Red Hat Enterprise Linux (RHEL)和CentOS等系统的包管理器。当遇到`yum install -y yum-utils`失败的情况,可能有以下几个原因: 1. **包不存在**:`yum-utils`可能不是默认安装的一部分,或者已经过时不再维护。确保你正在尝试安装的版本适用于你的系统。 2. **网络问题**:如果无法连接到互联网,`yum`会因为找不到所需的软件包而失败。检查网络连接,或者尝试使用代理服务器。 3. **依赖缺失**:`yum-utils`可能需要其他软件包作为先决条件才能安装。运行`yum check`或`yum list dependencies yum-utils`查看是否有缺失的依赖。 4. **限问题**:如果你没有足够的限来安装,你需要使用具有管理员限(如`sudo`)。 5. **yum配置问题**:`yum`的配置文件可能存在问题,比如镜像源不可用或者配置了错误的优先级。检查`/etc/yum.conf`或系统代理设置。 6. **软件仓库问题**:如果`yum-utils`不在默认仓库里,但你在`repofiles`或其他自定义列表中没有正确添加,需要更新或添加正确的存储库。 要解决这个问题,你可以按照以下步骤尝试: 1. **确认软件包存在**:使用`yum search yum-utils`看是否能找到该包。 2. **修复网络**:检查网络连接并确保可以访问`yum`服务器。 3. **解决依赖**:使用`yum dependency resolve yum-utils`找出并安装缺失的依赖。 4. **更新配置**:查看并修正`yum`配置文件,确保正确设置仓库和优先级。 5. **重新授**:如果有限问题,使用`sudo yum install yum-utils`。 6. **刷新仓库**:执行`yum makecache`或`yum update metadata`来刷新仓库信息。 如果你提供更具体的错误信息,我可以给出更针对性的建议。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值