Failed to execute yum install

Want to install:

[root@localhost ~]# yum install lrzsz
Updating Subscription Management repository.
Unable to read customer identity

This system has not been registered with the rights server. Registration can be done using 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]
Error: Failed to download metadata for repository ‘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
Updating Subscription Management repository.
Unable to read customer identity

This system has not been registered with the rights server. Registration can be done using 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]
Error: Failed to download metadata for repository ‘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: Unable to obtain file status (stat) for ‘/etc/yum.repos.d/CentOS-Base.repo’: No such file or directory
[root@localhost ~]# ll /etc/yum.repos.d/

It is found that an error is always reported.

Do I need to switch sources?

[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
Updating Subscription Management repository.
Unable to read customer identity

This system has not been registered with the rights server. Registration can be done using subscription-manager.

Repository base is listed more than once in the configuration
Repository extras are 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]
Error: Failed to download metadata for repository ‘RHEL9-BaseOS’ : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost yum.repos.d]#ll
Total usage 16
-rw-r–r–. 1 root root 2495 August 4 2022 CentOS-Base.repo
-rw-r–r–. 1 root root 2495 August 4 2022 CentOS-LinuxBaseOS.repo
-rw-r–r–. 1 root root 358 April 24 2023 redhat.repo
-rw-r–r–. 1 root root 369 April 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
Updating Subscription Management repository.
Unable to read customer identity

This system has not been registered with the rights server. Registration can be done using subscription-manager.

Repository base is listed more than once in the configuration
Repository extras are 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]
Error: Failed to download metadata for repository ‘RHEL9-BaseOS’ : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost yum.repos.d]# yum install lrzsz
Updating Subscription Management repository.
Unable to read customer identity

This system has not been registered with the rights server. Registration can be done using subscription-manager.

Repository base is listed more than once in the configuration
Repository extras are 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]
Error: Failed to download metadata for repository ‘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

Done.

It turns out that it is rhel8.repo. Its content is as follows:

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

name=RHEL9-BaseOS

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

gpgcheck=0

#gpgcheck=1 #If gpgcheck is 1, you need to write the secret key file path

#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

It can be seen that it is not a network source, but a local mirror source. so. .