环境使用的是redhat6.1 64bit。
1.设置虚拟机的硬件,在光驱处选择系统的安装镜像,这一步在开机关机的时候都可以。
2.在开机的情况下,右击vmware下面的光驱,选择连接。
3.接下来需要配置一下系统/etc/yum.repos.d/rhel-source.repo配置文件,另外,我是把光盘挂载到了/mnt/iso下面,具体过程如下:
[root@localhost ~]# df -h #选择光驱连接后,镜像默认被挂载在/media下面,但是我打算把他挂载到/mnt/iso下面
文件系统 容量 已用 可用 已用%% 挂载点
/dev/sda2 9.9G 3.2G 6.2G 35% /
tmpfs 497M 420K 497M 1% /dev/shm
/dev/sda1 194M 27M 158M 15% /boot
/dev/sda6 54M 25M 26M 50% /quota
/dev/sr0 3.4G 3.4G 0 100% /media/RHEL_6.1 x86_64 Disc 1
[root@localhost ~]# mkdir /mnt/iso #先创建挂载点
[root@localhost ~]# ls /mnt/iso
[root@localhost ~]# mount /dev/sr0 /mnt/iso/ #挂载
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# df -hT #查看一下挂载情况
文件系统 类型 容量 已用 可用 已用%% 挂载点
/dev/sda2 ext4 9.9G 3.2G 6.2G 35% /
tmpfs tmpfs 497M 420K 497M 1% /dev/shm
/dev/sda1 ext4 194M 27M 158M 15% /boot
/dev/sda6 ext4 54M 25M 26M 50% /quota
/dev/sr0 iso9660 3.4G 3.4G 0 100% /media/RHEL_6.1 x86_64 Disc 1
/dev/sr0 iso9660 3.4G 3.4G 0 100% /mnt/iso #已经挂上去了
[root@localhost ~]# cd /mnt/iso/
[root@localhost iso]# ls
EFI RELEASE-NOTES-es-ES.html RELEASE-NOTES-si-LK.html
EULA RELEASE-NOTES-fr-FR.html RELEASE-NOTES-ta-IN.html
GPL RELEASE-NOTES-gu-IN.html RELEASE-NOTES-te-IN.html
HighAvailability RELEASE-NOTES-hi-IN.html RELEASE-NOTES-zh-CN.html
images RELEASE-NOTES-it-IT.html RELEASE-NOTES-zh-TW.html
isolinux RELEASE-NOTES-ja-JP.html repodata #可以看到这里有个repodata文件,修改配置文件的时候需要写这个文件的所在目录
LoadBalancer RELEASE-NOTES-kn-IN.html ResilientStorage
media.repo RELEASE-NOTES-ko-KR.html RPM-GPG-KEY-redhat-beta
Packages RELEASE-NOTES-ml-IN.html RPM-GPG-KEY-redhat-release
README RELEASE-NOTES-mr-IN.html ScalableFileSystem
RELEASE-NOTES-as-IN.html RELEASE-NOTES-or-IN.html Server
RELEASE-NOTES-bn-IN.html RELEASE-NOTES-pa-IN.html TRANS.TBL
RELEASE-NOTES-de-DE.html RELEASE-NOTES-pt-BR.html
RELEASE-NOTES-en-US.html RELEASE-NOTES-ru-RU.html
[root@localhost iso]# vim /etc/yum.repos.d/rhel-source.repo #修改这个配置文件
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/iso #这里最重要了,需要写repodata所在目录的路径,这里是/mnt/iso
enabled=1 #使此源生效
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@localhost iso]# yum list|grep ftp #保存退出后,可以用yum list查看是否有很多安装软件了,这里测试了下ftp,有说明yum源配置成功了,呵呵。
ftp.x86_64 0.17-51.1.el6 @rhel-source
gvfs-obexftp.x86_64 1.4.3-12.el6 @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1
lftp.x86_64 4.0.9-1.el6 @rhel-source
report-config-ftp.x86_64 0.18-9.el6 @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1
report-plugin-ftp.x86_64 0.18-9.el6 @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1
vsftpd.x86_64 2.2.2-6.el6_0.1 @rhel-source
lftp.i686 4.0.9-1.el6 rhel-source
tftp.x86_64 0.49-5.1.el6 rhel-source
tftp-server.x86_64 0.49-5.1.el6 rhel-source
[root@localhost iso]#