VirtualBox下RedHat 5.4 使用DVD光盘作为yum源
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缓存配置,使新路径生效
- [root@localhost ~]# yum clean all
- Loaded plugins: fastestmirror
- Cleaning up Everything
- Cleaning up list of fastest mirrors
至此配置完成,yum就可以使用了,不过下次使用的时候记得加载光盘或者设置为开机自动加载。