[Errno 14] Could not open/read repomd.xml

 在配置CentOS-6.0-x86_64-bin-DVD2.iso做爲本地yum源的時候,碰到至關多的問題:sql

-----------------------------------------  問題一  ------------------------------------------數據庫

將CentOS-6.0-x86_64-bin-DVD2.iso掛載在/mnt上,並配置本地yum源:centos

  
  
           
  
  
  1. #mount /root/CentOS-6.0-x86_64-bin-DVD2.iso /mnt -o loop 
  2. #vi /etc/yum.repos.d/software.repo 
  3.  [software] 
  4.  name=software 
  5.  baseurl=file:///mnt 
  6.  enabled=1 
  7.  gpgcheck=1 
  8.  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
  9. #yum repolist 

而後就報錯了-_-!,錯誤的信息差很少就是:ide

file:///mnt/repodata/repomd.xml: [Errno 14] Could not open/read file:///mnt/repodata/repomd.xml . mistake from baseurl does not contain the repodata directory工具

問題出現的緣由:oop

CentOS-6.0-x86_64-bin-DVD2.iso這個鏡像裏沒有包含yum的包索引數據庫repomd.xml,這個文件通常是放在repodata文件夾的。因此,不用特殊的工具,這個CentOS-6.0-x86_64-bin-DVD2.iso中包含的Packages不能單獨做爲yum的本地源。url

-----------------------------------------  問題二  ------------------------------------------spa

在個人CentOS-6中,/etc/yum.repos.d/目錄下自己已經有3個已經建好的repo庫了,是Base、Media、Debug。xml

我本身新建一個software.repo,使用CentOS-6.0-x86_64-bin-DVD1.iso這個鏡像,這個鏡像中包含repodata文件。索引

但無論我怎麼調整設置,用yum repolist命令都搜不到iso中包含的軟件包,而且將全部的.repo中的enabled值都設置爲1,但使用yum repolist會提示錯誤:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=centosplus error was 14:
PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot retrieve repository metadata (repomd.xml) for repository: centosplus. 
Please verify its path and try again

解決方法:要使用本身新建的yum本地源,須要將系統自己提供的.repo庫暫時設置爲禁用(enabled=0),這樣的狀況下,使用yum repolist就能夠正確的搜索iso提供的本地軟件包庫了。


附:創建本地yum源的步驟:

一、將帶有軟件包和相應repodata索引的iso鏡像掛載在某目錄下(我是放在/mnt下)

二、在/etc/yum.repos.d/下創建本身的配置文件(例如software.repo),必須用.repo結尾,內容爲:

  
  
           
  
  
  1. [software]                     //software是配置名 
  2. name=software 
  3. baseurl=file:///mnt/           //由於是本地源,因此是file://,指向軟件庫和repodata的父目錄 
  4. enabled=1                      //激活這個配置 
  5. gpgcheck=0                     //不進行gpg檢查 

三、將yum.repos.d/目錄下得其餘配置文件的enabled鍵值設置爲0,不然按順序執行時會干擾本身創建的配置文件。

相關文章
相關標籤/搜索