RHEL 5.7 Yum配置本地源[Errno 2] No such file or directory

來源:互聯網
上載者:User

RHEL 5.7 Yum配置本地源[Errno 2] No such file or directory
在Red Hat Enterprise Linux Server release 5.7 上配置YUM本地源時,遇到了"Errno 5] OSError: [Errno 2] No such file or directory xxxx",花了點時間搞清楚錯誤的來龍去脈。特此記錄一下: 將Redhat 5.7的光碟片鏡像拷貝到了/mnt/cdrom/LinuxSrc目錄下,配置了rhel-media.repo檔案,如下所示 

[root@DB-Server yum.repos.d]# more rhel-media.repo [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 

 

執行yum clean all命令後,執行yum makecache遇到了下面錯誤:
[root@DB-Server yum.repos.d]# yum clean allLoaded plugins: product-id, security, subscription-managerUpdating Red Hat repositories.Cleaning up Everything[root@DB-Server yum.repos.d]# yum makecacheLoaded plugins: product-id, security, subscription-managerUpdating 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]# clip_image001

 

出現這個錯誤的根本原因在於RHEL 5.x 版本與RHEL 6.x 版本的rpm包存放路徑不同: RHEL 5.x : ../Server    例如:我案例環境位於/mnt/cdrom/LinuxSrc/Server 下。 RHEL 6.x : ../Packages 所以還在於上面的baseurl參數設定錯誤。那麼我們可以通過兩種方法解決這個問題:   方法1:配置正確的baseurl參數。 
[root@DB-Server yum.repos.d]# vi rhel-media.repo [media]name=Red Hat Enterprise Linux 5.7baseurl=file:///mnt/cdrom/LinuxSrc/Serverenabled=1gpgcheck=0gpgkey=file:///mnt/cdrom/LinuxSrc/RPM-GPG-KEY-redhat-releaseclip_image002

 

  方法2:使用createrepo命令建立本地來源目錄,將其指向baseurl指定的目錄 
 [root@DB-Server Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpmwarning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing...                ########################################### [100%]   1:createrepo             ########################################### [100%][root@DB-Server Server]# createrepo --update /mnt/cdrom/LinuxSrcPrevious repo file missing: /mnt/cdrom/LinuxSrc/repodata/primary.xml.gz3388/3388 - VT/etherboot-roms-5.4.4-15.el5.x86_64.rpm                           mmSaving Primary metadataSaving file lists metadataSaving other metadataYou have new mail in /var/spool/mail/root[root@DB-Server Server]# yum makecacheLoaded plugins: product-id, security, subscription-managerUpdating Red Hat repositories.media                    |  951 B     00:00     media/filelists          | 3.1 MB     00:00     media/other              |  11 MB     00:00     media/primary            | 1.1 MB     00:00     media                                 3388/3388media                                 3388/3388media                                 3388/3388Metadata Cache Created[root@DB-Server Server]# 

 


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.