执行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
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值