真实的集群环境,但是为了图成本没有配光驱,系统通过U盘安装的。现在配置本地yum源
将 CentOS-6.0-x86_64-bin-DVD1.iso 上传到机器中,我的存放位置是:/home/node1/iso/CentOS-6.0-x86_64-bin-DVD1.iso,
使用虚拟光驱挂载该ISO文件:mount -t iso9660 -o loop /home/node1/iso/CentOS-6.0-x86_64-bin-DVD1.iso /mnt
转到 /mnt 目录底下查看,如果成功那么应该看到ISO里面的各个文件:
[root@node1 mnt]# ls
CentOS_BuildTag EULA images Packages repodata RPM-GPG-KEY-CentOS-Debug-6 RPM-GPG-KEY-CentOS-Testing-6
EFI GPL isolinux RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-6 RPM-GPG-KEY-CentOS-Security-6 TRANS.TBL
接下来,修改yum源,转到 /etc/yum.repos.d/ 目录下执行备份:
mv CentOS-Base.repo CentOS-Base.repo.bk
mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bk
cp CentOS-Media.repo CentOS-Media.repo.bk
再编辑CentOS-Media.repo文件、
vi CentOS-Media.repo
编辑后内容如下:
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-6. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/
gpgcheck=1
enabled=1
priority=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
保存即可。
接下来可以使用了!