yum 源不可用,报 media 错误

1.提出问题  yum 源不可用,报 media 错误 
[root@localhost repodata]# yum install php
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php to pack into transaction set.
media://1170972069.396645%232/php-5.1.6-5.el5.i386.rpm: [Errno 4] IOError: <urlopen error unknown url type: media>
Trying other mirror.
Error: failed to retrieve php-5.1.6-5.el5.i386.rpm from dvd
error was [Errno 4] IOError: <urlopen error unknown url type: media>

2.系统环境:
红帽rhel:rhel-5-server-i386

系统镜像:rhel-5-server-i386-disc1.iso

rhel-5-server-i386-disc2.iso

rhel-5-server-i386-disc3.iso

rhel-5-server-i386-disc4.iso

rhel-5-server-i386-disc5.iso


软件环境:
yum-metadata-parser-1.0-8.fc6
yum-3.0.1-5.el5
yum-rhn-plugin-0.4.3-1.el5
yum-updatesd-3.0.1-5.el5


3.yum源配置:
mkdir /mnt/cdrom
mount /XXX/rhel.5.0.server.centoschina.com.dvd.iso  /mnt/cdrom -o 

echo '
[dvd]
name=install dvd
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0' >/etc/yum.repos.d/dvd.repo 

4.yum 测试
[root@localhost repodata]# yum install php
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php to pack into transaction set.
media://1170972069.396645%232/php-5.1.6-5.el5.i386.rpm: [Errno 4] IOError: <urlopen error unknown url type: media>
Trying other mirror.
Error: failed to retrieve php-5.1.6-5.el5.i386.rpm from dvd
error was [Errno 4] IOError: <urlopen error unknown url type: media>

5.错误原因:
编辑/usr/lib/python2.4/site-packages/yum/yumRepo.py文件。
找到remote = url + '/' + relative
改成下面这样就可以了。
#remote = url + '/' + relative #这行是原来的,作者: Acorex
2.X版本的yum是没有问题的。
3.X版本的yum就有问题了,我从FC6-i386-DVD.iso光盘装的,就有问题。

编辑/usr/lib/python2.4/site-packages/yum/yumRepo.py文件。
找到remote = url + '/' + relative
改成下面这样就可以了。
#remote = url + '/' + relative #这行是原来的,注释掉
remote = '/mnt/DVD/' + relative #这行拷贝以后修改/mnt/DVD/是你挂载镜像的位置置
----------------------------

6.修正错误:
remote = url + '/' + relative  改为:remote =  '/mnt/cdrom/Server' + relative 
说明:/mnt/cdrom 是加载后iso的目录,/mnt/cdrom/Server里面存放rpm 安装包。

7.重新测试 

[root@localhost Server]# yum install php
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php to pack into transaction set.
---> Package php.i386 0:5.1.6-5.el5 set to be updated
--> Running transaction check
--> Processing Dependency: php-common = 5.1.6-5.el5 for package: php
--> Processing Dependency: libgmp.so.3 for package: php
--> Processing Dependency: httpd-mmn = 20051115 for package: php
--> Processing Dependency: php-cli = 5.1.6-5.el5 for package: php
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for httpd to pack into transaction set.
---> Package httpd.i386 0:2.2.3-6.el5 set to be updated
---> Downloading header for php-cli to pack into transaction set.
---> Package php-cli.i386 0:5.1.6-5.el5 set to be updated
---> Downloading header for gmp to pack into transaction set.
---> Package gmp.i386 0:4.1.4-10.el5 set to be updated
---> Downloading header for php-common to pack into transaction set.
---> Package php-common.i386 0:5.1.6-5.el5 set to be updated
--> Running transaction check
--> Processing Dependency: libaprutil-1.so.0 for package: httpd
--> Processing Dependency: libapr-1.so.0 for package: httpd
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for apr-util to pack into transaction set.
---> Package apr-util.i386 0:1.2.7-6 set to be updated
---> Downloading header for apr to pack into transaction set.
---> Package apr.i386 0:1.2.7-11 set to be updated
--> Running transaction check
--> Processing Dependency: libpq.so.4 for package: apr-util
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for postgresql-libs to pack into transaction set.
---> Package postgresql-libs.i386 0:8.1.4-1.1 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 php                     i386       5.1.6-5.el5      dvd               1.2 M
Installing for dependencies:
 apr                     i386       1.2.7-11         dvd               123 k
 apr-util                i386       1.2.7-6          dvd                76 k
 gmp                     i386       4.1.4-10.el5     dvd               665 k
 httpd                   i386       2.2.3-6.el5      dvd               1.1 M
 php-cli                 i386       5.1.6-5.el5      dvd               2.2 M
 php-common              i386       5.1.6-5.el5      dvd               139 k
 postgresql-libs         i386       8.1.4-1.1        dvd               195 k

Transaction Summary
=============================================================================
Install      8 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 5.7 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
warning: apr-util-1.2.7-6: Header V3 DSA signature: NOKEY, key ID 37017186
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: apr                          ######################### [1/8] 
  Installing: gmp                          ######################### [2/8] 
  Installing: php-common                   ######################### [3/8] 
  Installing: php-cli                      ######################### [4/8] 
  Installing: postgresql-libs              ######################### [5/8] 
  Installing: apr-util                     ######################### [6/8] 
  Installing: httpd                        ######################### [7/8] 
  Installing: php                          ######################### [8/8] 

Installed: php.i386 0:5.1.6-5.el5
Dependency Installed: apr.i386 0:1.2.7-11 apr-util.i386 0:1.2.7-6 gmp.i386 0:4.1.4-10.el5 httpd.i386 0:2.2.3-6.el5 php-cli.i386 0:5.1.6-5.el5 php-common.i386 0:5.1.6-5.el5 postgresql-libs.i386 0:8.1.4-1.1
Complete!

8.最后说明:
并不是所有的系统都出现这种问题,本人在红帽企业版5.3 5.4 5.5 -64位系统中,都没有这出现这种问题。

9。脚本:
sed -i "s@remote = url + '/' + relative@remote = '/mnt/cdrom/Server/' + relative@g" 2


9.相关资料连接。
标题: 请教一个用yum(fc6)从iso安装软件的问题
http://www.linuxsir.org/bbs/showthread.php?postid=1576875
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值