RHEL 5.7 Yum configuration local source [Errno 2] No such file or directory
When configuring the YUM local source on Red Hat Enterprise Linux Server release 5.7, you encounter "Errno 5] OSError: [Errno 2] No such file or directory xxxx ", it took some time to figure out the ins and outs of errors. Record:
Copy the CD image of RedHat 5.7 to the/mnt/cdrom/LinuxSrc directory and configure the rhel-media.repo file, as shown below
[Root @ DB-Server yum. repos. d] # rhel-media.repo more
[Media]
Name = Red Hat Enterprise Linux 5.7
Baseurl = file: // mnt/cdrom/LinuxSrc
Enabled = 1
Gpgcheck = 0
Gpgkey = file: // mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-release
After the yum clean all command is executed, the following error occurs when yum makecache is executed:
[Root @ DB-Server yum. repos. d] # yum clean all
Loaded plugins: product-id, security, sub‑manager
Updating Red Hat repositories.
Cleaning up Everything
[Root @ DB-Server yum. repos. d] # yum makecache
Loaded plugins: product-id, security, sub‑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 path of the rpm package in RHEL 5.x and RHEL 6.x is different:
RHEL 5.x: ../Server for example: in my case, the environment is located under/mnt/cdrom/LinuxSrc/Server.
RHEL 6.x: ../Packages
Therefore, the above baseurl parameter settings are incorrect. We can solve this problem in two ways:
Method 1: configure the correct baseurl parameters.
[Root @ database-Server yum. repos. d] # vi rhel-media.repo
[Media]
Name = Red Hat Enterprise Linux 5.7
Baseurl = file: // mnt/cdrom/LinuxSrc/Server
Enabled = 1
Gpgcheck = 0
Gpgkey = file: // mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-release
Method 2: run the createrepo command to create a local source directory and direct it to the directory specified by baseurl.
[Root @ DB-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] # createrepo -- update/mnt/cdrom/LinuxSrc
Previous repo file missing:/mnt/cdrom/LinuxSrc/repodata/primary.xml.gz
3388/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] # yum makecache
Loaded plugins: product-id, security, sub‑manager
Updating Red Hat repositories.
Media | 951 B 00: 00
Media/filelists | 3.1 MB
Media/other | 11 MB: 00
Media/primary | 1.1 MB: 00
Medialist 3388/3388
Medialist 3388/3388
Medialist 3388/3388
Metadata Cache Created
[Root @ DB-Server] #
For more YUM tutorials, see the following:
RedHat 6.2 modify yum source in Linux use CentOS source for free
Configure the epel yum Source
Redhat local yum source configuration
Description of yum configuration file
Install yum in RedHat 6.1)
YUM installation and cleaning
Build yum local source on CentOS 6.4