When configuring the YUM local source on RedHatEnterpriseLinuxServerrelease5.7, we encountered "Errno5] OSError: [Errno2] Nosuchfileordirectoryxxxx", which took some time to figure out the ins and outs of errors. Copy the RedHat5.7 CD image to the/mnt/cdrom/LinuxSrc directory, and configure rhel-med
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 content::
RedHat 6.2 Linux modify yum source free use CentOS source http://www.linuxidc.com/Linux/2013-07/87383.htm
Configure epel yum source http://www.linuxidc.com/Linux/2012-10/71850.htm
Redhat local yum source configuration http://www.linuxidc.com/Linux/2012-11/75127.htm
Yum profile description http://www.linuxidc.com/Linux/2013-04/83298.htm
Install yum http://www.linuxidc.com/Linux/2013-06/86535.htm in RedHat 6.1
YUM installation and cleaning http://www.linuxidc.com/Linux/2013-07/87163.htm
Build yum local ground source http://www.linuxidc.com/Linux/2014-07/104533.htm on CentOS 6.4
For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-09/123504.htm