红联Linux门户
Linux帮助

RHEL5.1用光盘做yum源

发布时间:2014-12-22 10:20:31来源:shocr.com作者:shocr.com

RHEL5.4可以直接使用光盘作yum源,而RHEL5.1不能直接用光盘中的源,否则会出现?urlopen error unknown url type: media,需要改造一番,注意这里提供的方法不用拷贝光盘中的大量文件.


1.将光盘镜像挂载到/media/RHEL/目录下
[root@www Desktop]#mkdir /media/RHEL
[root@www Desktop]#mount /root/rhel5.1.iso /media/RHEL -o loop


2.生成库文件
[root@www Desktop]#mkdir /media/yum/
[root@www Desktop]#rpm -ivh /media/RHEL/Server/createrepo-0.4.4-2.fc6.noarch.rpm
[root@www Desktop]createrepo -o /media/yum/ -g /media/RHEL/Server/repodata/comps-rhel5-server-core.xml /media/RHEL/Server/
[root@www Desktop]mount --bind /media/yum/repodate/ /media/RHEL/Server/repodate/


3.生成依赖关系
[root@www Desktop]# vim /etc/yum.repos.d/rhel-debuginfo.repo

修改为类似
[rhel]
name=Red
baseurl=file:///media/RHEL/Server/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
[root@www Desktop]# yum clean all;yum makecache

RHEL5.1下的本地YUM源就这样OK了,注意,这里并没有拷贝大量的文件,而是挂载.


urlopen error unknown url type: media

RHEL5.1 直接挂载光盘做yum看来是不成功的,安装软件提示error was [Errno 4] IOError:

--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vsftpd to pack into transaction set.
media://1250663123.136977%232/vsftpd-2.0.5-16.el5.i386.rpm: [Errno 4] IOError:
Trying other mirror.
Error: failed to retrieve vsftpd-2.0.5-16.el5.i386.rpm from rhel
error was [Errno 4] IOError:

不过本人知道RHEL5.4是可以用光盘并且直接作yum的.没办法,RHEL5.1下只能将光盘内Server目录拷贝到本地,然后再做设置,记住别忘记createrepo.