Cannot retrieve repository metadata 處理記錄
系統(tǒng):oel5.4
問題描述:oel5.4系統(tǒng)按linux 6配置好yum源后,執(zhí)行yum makecache報錯,如下所示:
[root@leo yum]# yum makecache
Loaded plugins: security
file:///mnt/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/mnt/repodata/repomd.xml'
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: oel5.4. Please verify its path and try again
[root@leo yum]# pwd
/usr/lib/python2.4/site-packages/yum
網上查詢資料,顯示可以根據(jù)修改yumRepo.py文件解決,如下:
[root@leo yum]# vi yumRepo.py
799行
remote = url + '/' + relative
修改成
remote = "/mnt" + '/' + relative
說明;修改之后依然報錯.
再次查詢確認出現(xiàn)這個錯誤的原因在于linux 5.x版本與linux 6.x版本的rpm包存放路徑不同:
RHEL 5.x : ../Server 說明:此環(huán)境中安裝包位于/mnt/Server
RHEL 6.x : ../Packages
因此baseurl參數(shù)配置錯誤
[root@leo yum.repos.d]# cat oel5.repo
[oel5.4]
name=oel5.4
baseurl=file:///mnt
enable=1
gpgcheck=0
解決方案:修改baseurl文件配置
[root@leo yum.repos.d]# vi oel5.repo
[root@leo yum.repos.d]# cat oel5.repo
[oel5.4]
name=oel5.4
baseurl=file:///mnt/Server
enable=1
gpgcheck=0
gpgkey=
file:///mnt/RPM-GPG-KEY-oracle
說明:按如上內容進行修改
[root@leo yum.repos.d]# yum makecache
Loaded plugins: security
oel5.4 | 1.1 kB 00:00
oel5.4/filelists | 2.3 MB 00:00
oel5.4/other | 7.0 MB 00:00
oel5.4/group | 1.0 MB 00:00
oel5.4/primary | 795 kB 00:00
oel5.4 2278/2278
oel5.4 2278/2278
oel5.4 2278/2278
Metadata Cache Created
結論:修改后成功執(zhí)行yum makecache命令.
