系统:oel5.4
问题描述:oel5.4系统按linux 6配置好yum源后,执行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
网上查询资料,显示可以根据修改yumRepo.py文件解决,如下:
[root@leo yum]# vi yumRepo.py
799行
remote = url + '/' + relative
修改成
remote = "/mnt" + '/' + relative
说明;修改之后依然报错.
再次查询确认出现这个错误的原因在于linux 5.x版本与linux 6.x版本的rpm包存放路径不同:
RHEL 5.x : ../Server 说明:此环境中安装包位于/mnt/Server
RHEL 6.x : ../Packages
因此baseurl参数配置错误
[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
结论:修改后成功执行yum makecache命令.
03-25
8579
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-26
867
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-01
2084
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-09
2128
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)