Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of [Errno 5] OSError: [Errno 2] on RedHat Server

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "how to solve the problem of [Errno 5] OSError: [Errno 2] on the RedHat server. Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the problem of [Errno 5] OSError: [Errno 2] on the RedHat server.

When configuring YUM local source on Red Hat Enterprise Linux Server release 5.7I encountered "[Errno 5] OSError: [Errno 2] No such file or directory xxxx" and took some time to figure out the cause of the error. Here is a record:

Copy the CD image of Redhat 5.7to the / mnt/cdrom/LinuxSrc directory and configure the rhel-media.repo file, as shown below

The code is as follows:

[root@DB-Server yum.repos.d] # more rhel-media.repo

[media]

Name=Red Hat Enterprise Linux 5.7baseurl= file:///mnt/cdrom/LinuxSrc

Enabled=1

Gpgcheck=0 gpgkey= file:///mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-release

After executing the yum clean all command, executing yum makecache encountered the following error:

The code is as follows:

[root@DB-Server yum.repos.d] # yum clean all

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Cleaning up Everything

[root@DB-Server yum.repos.d] # yum makecache

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

File:///mnt/cdrom/LinuxSrc/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory:'/ mnt/cdrom/LinuxSrc/repodata/repomd.xml'

Trying other mirror.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: media. Please verify its path and try again

[root@DB-Server yum.repos.d] #

The root cause of this error is that the rpm package storage paths for RHEL version 5.x and RHEL version 6.x are different:

RHEL 5.x:.. / Server for example: my case environment is under / mnt/cdrom/LinuxSrc/Server.

RHEL 6.x:.. / Packages

So it also lies in the wrong setting of the baseurl parameter above. Then we can solve this problem in two ways:

Method 1: configure the correct baseurl parameters.

The code is as follows:

[root@DB-Server yum.repos.d] # vi rhel-media.repo

[media]

Name=Red Hat Enterprise Linux 5.7baseurl= file:///mnt/cdrom/LinuxSrc/Server

Enabled=1

Gpgcheck=0

Gpgkey= file:///mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-release

Method 2: use the createrepo command to create a local source directory and point it to the directory specified by baseurl

The code is as follows:

[root@DB-Server Server] # rpm-ivh createrepo-0.4.11-3.el5.noarch.rpm

Warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:createrepo # # [100%]

[root@DB-Server Server] # createrepo-- update / mnt/cdrom/LinuxSrc

Previous repo file missing: / mnt/cdrom/LinuxSrc/repodata/primary.xml.gz3388/3388-VT/etherboot-roms-5.4.4-15.el5.x86_64.rpm mm

Saving Primary metadata

Saving file lists metadata

Saving other metadata

You have new mail in / var/spool/mail/root

[root@DB-Server Server] # yum makecacheLoaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Media | 951B 00:00

Media/filelists | 3.1 MB 00:00

Media/other | 11 MB 00:00

Media/primary | 1.1 MB 00:00

Media 3388/3388

Media 3388/3388

Media 3388/3388

Metadata Cache Created [root@DB-Server Server] #

At this point, I believe you have a deeper understanding of "how to solve the problem of [Errno 5] OSError: [Errno 2] on the RedHat server. You might as well do it in practice." Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report