RedHat 5.4 使用DVD光盘作为yum源
2011-12-19 10:27

1、首先挂载光盘

设备-分配光驱-Choose a virtual CD/DVD disk file 选择DVD镜像,此时镜像被自动加载到

/media/RHEL_5.4 x86_64 DVD

2、新建/etc/yum.repos.d/dvd.repo,添加如下内容并保存

[base]
name=Server
baseurl=file:///media/RHEL_5.4%20x86_64%20DVD/Server

enable=1
gpcheck=1
gpgkey=file:///media/RHEL_5.4%20x86_64%20DVD/RPM-GPG-KEY-RedHat-release

注:由于文件路径中有空格,所以需要将其转义成%20

如果还需要安装关于cluster、clusterstorage或者xen相关的软件包,只须再添加以下内容:
[VT]
name=VT
baseurl=file:///media/RHEL_5.4%20x86_64%20DVD/VT
enable=1
gpcheck=1
gpgkey=file:///media/RHEL_5.4%20x86_64%20DVD/RPM-GPG-KEY-RedHat-release
[Cluster]
name=Cluster
baseurl=file:///media/RHEL_5.4%20x86_64%20DVD/Cluster
enable=1
gpcheck=1
gpgkey=file:///media/RHEL_5.4%20x86_64%20DVD/RPM-GPG-KEY-RedHat-release
[CS]
name=ClusterStorage
baseurl=file:///media/RHEL_5.4%20x86_64%20DVD/ClusterStorage
enable=1
gpcheck=1
gpgkey=file:///media/RHEL_5.4%20x86_64%20DVD/RPM-GPG-KEY-RedHat-release

3、清空yum缓存配置,使新路径生效

1.[root@localhost ~]# yum clean all
2.Loaded plugins: fastestmirror
3.Cleaning up Everything
4.Cleaning up list of fastest mirrors

至此配置完成,yum就可以使用了,不过下次使用的时候记得加载光盘或者设置为开机自动加载。

本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux/2011-12/49709.htm