RHEL8教学环境安装到VMware Workstation上的虚拟机

不打扰是莪最后的温柔 提交于 2019-11-26 10:20:24

安装Red Hat Enterprise Linux 8教学环境时,学员们都需要将这个环境安装到虚拟机中,以便在自己的笔记本电脑上练习使用。一般推荐使用VMware Workstation来托管整个教学环境。

准备:

1)移动硬盘

2)16G以上的USB盘

3)RHEL8教学环境软件

第1步:校验教学环境软件是否完整

# yum install -y http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/python3-pyyaml-3.12-12.el8.i686.rpm

# ./rht-usb-8.x-7.r2019052915git14db55b verify RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf

Verifying manifest file RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf
  Publish date: 2019-05-29 15:41:50
  type        md5sum  artifact-name
  ----------- ------- -----------------------------------------------
  content     GOODSUM rhel-8.0-x86_64-dvd.iso
  content     GOODSUM foundation-config-8.x-7.r2019052915git14db55b.noarch.rpm
  content     GOODSUM foundation0-config-8.x-7.r2019052915git14db55b.noarch.rpm
  content     GOODSUM redhat-survey-7.x-58.0.noarch.rpm
  content     GOODSUM redhat-training-survey-7-59.4.noarch.rpm
  content     GOODSUM redhat-training-roster-7-59.1.noarch.rpm
  content     GOODSUM rhci-foundation-8.0-7.r2019052915gitc76cfec.iso
  content     GOODSUM rht-usb-8.x-7.r2019052915git14db55b
  content     GOODSUM rht-usb-7.x-6.r2019052915git14db55b
  content     GOODSUM ClassroomSetup-8.x-7.r2019052915git14db55b.txt
  content     GOODSUM ClassroomReset-8.x-7.r2019052915git14db55b.txt
  content     GOODSUM ClassroomTroubleshooting-8.x-7.r2019052915git14db55b.txt
  content     GOODSUM ClassPrep-8.x-7.r2019052915git14db55b.txt
=====================================================================
INFO     Manifest RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf passed.

INFO     Verification SUCCEEDED

第2步:格式化USB盘
 

# lsblk

# umount /dev/sdc1

# cd /mnt/hd/rhel8
//我的红帽教学环境放在移动硬盘里,挂载到这个目录下

# ./rht-usb-8.x-7.r2019052915git14db55b usbmkpart /dev/sdc gpt
//有一个rht-usb-xxxx的工具,用它来为U盘分区,分为gpt分区

INFO     Configuration file: /root/.icrm/config.yml
INFO     Partitioning USB Device: /dev/sdc
Confirm gpt partitioning /dev/sdc (y/N) y
Wipe existing partitioning of /dev/sdc (y/N) y
INFO     /dev/sdc: zap partitions OK
INFO     /dev/sdc: wipe partitions OK
INFO     /dev/sdc: partitioning OK
INFO     /dev/sdc3: apparent RHTINST partition
INFO     Now run usbformat of /dev/sdc3
INFO     Appear to have properly partitioned USB device.

查看一下,发现上述命令将我这个64G的USB盘分成3个区,如下:

sdc               8:32   1   60G  0 disk 
├─sdc1            8:33   1    1M  0 part 
├─sdc2            8:34   1  200M  0 part 
└─sdc3            8:35   1 59.8G  0 part 

将第3个分区格式化。

# ./rht-usb-8.x-7.r2019052915git14db55b usbformat /dev/sdc3

INFO     Configuration file: /root/.icrm/config.yml
INFO     Formatting USB Partition: /dev/sdc3
Confirm reformatting /dev/sdc3 (y/N) y
INFO     mkfs.ext4 64-bit support
INFO     mkfs.ext4 no metadata_csum support
INFO     /dev/sdc3: format OK
INFO     Appear to have properly formatted USB device.

 

第3步:将Foundation虚拟机拷贝到USB盘上

# ./rht-usb-8.x-7.r2019052915git14db55b usbadd RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf 

INFO     Configuration file: /root/.icrm/config.yml
INFO     Adding to USB: RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf
INFO     New files needed space is 7.2G out of 7.2G
INFO     Calculation finds we need: 7779043345 bytes (7.2G)
INFO     USB space Total: 59.8G  Used: 51.8M  Free: 56.7G
INFO     Copying manifest file: RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf (3.2K) to /tmp/tmpa2r6ijh6/manifests/RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf
INFO     Starting copy of RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf
INFO     Copying artifact: rhel-8.0-x86_64-dvd.iso
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/rhel-8.0-x86_64-dvd.iso (6.6G) to /tmp/tmpa2r6ijh6/rhel8.0/x86_64/isos/rhel-8.0-x86_64-dvd.iso
INFO     Copying artifact: foundation-config-8.x-7.r2019052915git14db55b.noarch.rpm
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/foundation-config-8.x-7.r2019052915git14db55b.noarch.rpm (37.8K) to /tmp/tmpa2r6ijh6/ucf/Packages/foundation-config-8.x-7.r2019052915git14db55b.noarch.rpm
INFO     Copying artifact: foundation0-config-8.x-7.r2019052915git14db55b.noarch.rpm
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/foundation0-config-8.x-7.r2019052915git14db55b.noarch.rpm (110.9K) to /tmp/tmpa2r6ijh6/ucf/Packages/foundation0-config-8.x-7.r2019052915git14db55b.noarch.rpm
INFO     Copying artifact: redhat-survey-7.x-58.0.noarch.rpm
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/redhat-survey-7.x-58.0.noarch.rpm (4.5K) to /tmp/tmpa2r6ijh6/rhtops/Packages/redhat-survey-7.x-58.0.noarch.rpm
INFO     Copying artifact: redhat-training-survey-7-59.4.noarch.rpm
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/redhat-training-survey-7-59.4.noarch.rpm (853.8K) to /tmp/tmpa2r6ijh6/ucf/Packages/redhat-training-survey-7-59.4.noarch.rpm
INFO     Copying artifact: redhat-training-roster-7-59.1.noarch.rpm
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/redhat-training-roster-7-59.1.noarch.rpm (906.0K) to /tmp/tmpa2r6ijh6/ucf/Packages/redhat-training-roster-7-59.1.noarch.rpm
INFO     Copying artifact: rhci-foundation-8.0-7.r2019052915gitc76cfec.iso
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/rhci-foundation-8.0-7.r2019052915gitc76cfec.iso (642.4M) to /tmp/tmpa2r6ijh6/boot/rhci-foundation-8.0-7.r2019052915gitc76cfec.iso
INFO     Extracting boot files: rhci-foundation-8.0-7.r2019052915gitc76cfec.iso
INFO     Copying /tmp/tmp35jicn2f/ (dir) to /tmp/tmpa2r6ijh6/boot (exists)
INFO     Copying artifact: rht-usb-8.x-7.r2019052915git14db55b
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/rht-usb-8.x-7.r2019052915git14db55b (154.8K) to /tmp/tmpa2r6ijh6/ks/rht-usb-8.x-7.r2019052915git14db55b
INFO     Copying artifact: rht-usb-7.x-6.r2019052915git14db55b
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/rht-usb-7.x-6.r2019052915git14db55b (154.8K) to /tmp/tmpa2r6ijh6/ks/rht-usb-7.x-6.r2019052915git14db55b
INFO     Copying artifact: ClassroomSetup-8.x-7.r2019052915git14db55b.txt
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/ClassroomSetup-8.x-7.r2019052915git14db55b.txt (48.1K) to /tmp/tmpa2r6ijh6/docs/ClassroomSetup-8.x-7.r2019052915git14db55b.txt
INFO     Copying artifact: ClassroomReset-8.x-7.r2019052915git14db55b.txt
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/ClassroomReset-8.x-7.r2019052915git14db55b.txt (20.5K) to /tmp/tmpa2r6ijh6/docs/ClassroomReset-8.x-7.r2019052915git14db55b.txt
INFO     Copying artifact: ClassroomTroubleshooting-8.x-7.r2019052915git14db55b.txt
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/ClassroomTroubleshooting-8.x-7.r2019052915git14db55b.txt (38.4K) to /tmp/tmpa2r6ijh6/docs/ClassroomTroubleshooting-8.x-7.r2019052915git14db55b.txt
INFO     Copying artifact: ClassPrep-8.x-7.r2019052915git14db55b.txt
INFO     Copying /mnt/hd/Redhat/rhce8/f0_rhel8/ClassPrep-8.x-7.r2019052915git14db55b.txt (31.2K) to /tmp/tmpa2r6ijh6/docs/ClassPrep-8.x-7.r2019052915git14db55b.txt
INFO     USBAdd completed.

第4步:检验拷贝的内容是否完整

# ./rht-usb-8.x-7.r2019052915git14db55b usbvalidate

INFO     Configuration file: /root/.icrm/config.yml
INFO     Validating USB Mountpoint: /tmp/tmptydq1lon
INFO     Device has three gpt partitions
INFO     Does have a required RHCIfoundation manifest
INFO     Not configured to be bootable

Verifying manifest file RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf
  Publish date: 2019-05-29 15:41:50
  type        md5sum  artifact-name
  ----------- ------- -----------------------------------------------
  content     GOODSUM rhel-8.0-x86_64-dvd.iso
  content     GOODSUM foundation-config-8.x-7.r2019052915git14db55b.noarch.rpm
  content     GOODSUM foundation0-config-8.x-7.r2019052915git14db55b.noarch.rpm
  content     GOODSUM redhat-survey-7.x-58.0.noarch.rpm
  content     GOODSUM redhat-training-survey-7-59.4.noarch.rpm
  content     GOODSUM redhat-training-roster-7-59.1.noarch.rpm
  content     GOODSUM rhci-foundation-8.0-7.r2019052915gitc76cfec.iso
  content     GOODSUM rht-usb-8.x-7.r2019052915git14db55b
  content     GOODSUM rht-usb-7.x-6.r2019052915git14db55b
  content     GOODSUM ClassroomSetup-8.x-7.r2019052915git14db55b.txt
  content     GOODSUM ClassroomReset-8.x-7.r2019052915git14db55b.txt
  content     GOODSUM ClassroomTroubleshooting-8.x-7.r2019052915git14db55b.txt
  content     GOODSUM ClassPrep-8.x-7.r2019052915git14db55b.txt
=====================================================================

INFO     Manifest RHCIfoundation-RHEL80-7.r2019052915-ILT-7-en_US.icmf passed.
INFO     USBValidate SUCCEEDED

 

第5步:将U盘设为可启动

*   This operation will manipulate the MBR of the mounted USB device.   *
   *   If something misleads the tool, IT COULD RENDER YOUR SYSTEM         *
   *   UNBOOTABLE. YOU HAVE BEEN WARNED!   

说有可能会把系统弄得无法启动,怎么办?

这一步需要系统上有两个命令parted和syslinux-extlinux。我的CentOS 7上没有syslinux-extlinux,于是我来安装一下。

# yum -y install syslinux-extlinux

运行命令,将USB设置成可以启动的盘。

# ./rht-usb-8.x-7.r2019052915git14db55b usbmkboot


INFO     Configuration file: /root/.icrm/config.yml

WARNING - You get to keep all the pieces if system becomes unbootable
WARNING - We really mean it - do not cry to us if your system is destroyed
Confirm writing to /dev/sdc3 mounted to /tmp/tmpmoukp5en (y/N) y


INFO     Making bootable: /tmp/tmpmoukp5en
INFO     Formatting FAT and copying EFI/ files to /dev/sdc2
INFO     /dev/sdc2: vfat format OK
INFO     Copying /tmp/tmpmoukp5en/boot/EFI (dir) to /tmp/tmpgc7y97_l (exists)
INFO     Copying extlinux menu files to /tmp/tmpmoukp5en/boot/extlinux
INFO     Copying /usr/share/syslinux/vesamenu.c32 (149.5K) to /tmp/tmpmoukp5en/boot/extlinux (exists)
INFO     Using extlinux to install to /tmp/tmpmoukp5en/boot/extlinux
INFO     /tmp/tmpmoukp5en/boot/extlinux: extlinux OK
INFO     Using chattr to remove immutable of /tmp/tmpmoukp5en/boot/extlinux/ldlinux.sys
INFO     /tmp/tmpmoukp5en/boot/extlinux: chattr OK
INFO     Using dd to write /usr/share/syslinux/gptmbr.bin to /dev/sdc
INFO     /dev/sdc: dd of mbr.bin OK
INFO     Using sgdisk to tag bootable /dev/sdc3
INFO     /dev/sdc3: sgdisk set of Legacy BIOS bootable flag OK
INFO     Appear to have successfully made USB bootable.

它只是向/tmp里写一个文件,怎么会弄坏我的操作系统呢?但是这是红帽公司的警告,是继续,还是放弃呢?最后,我还是按下了y!

一切正常!!!

/dev/sdc2被格式化成vfat格式,写入的是/boot/EFI?

第6步:将课程的内容拷贝到USB盘上

还是使用那个

rht-usb-xxx usbadd RHCI*.icmf   //添加foundation虚拟机

rht-usb-xxx usbadd RH124*.icmf   //添加课程RH124

rht-usb-xxx usbadd RH134*.icmf   //添加课程RH134

rht-usb-xxx usbadd RH294*.icmf   //添加课程RH294

以上几个步骤会花费很久的时间。

第7步:用Foundation ISO安装到一个虚拟机上

这一步有一个难点:RHEL 8 / CentOS 8 无法识别硬盘。我也看到网上有不少朋友通过修改虚拟机的配置文件来纠正,可是,我的虚拟机上看不到那个选项。而实际上并没有那么复杂。我们在创建完成后,不要启动,把原来的硬盘删除,重新创建一个SATA硬盘即可。VMware Workstation 推荐使用的是SCSI硬盘。配置如下:

处理器:2 (虚拟化:勾选Intel VT-x或AMD-V)

内存:8G

硬盘:150G (SATA)

USB:支持3.0(以挂载我的USB或移动硬盘)

光驱:使用ISO文件rhci-foundation-8.0-7.r2019052915gitc76cfec.iso

出现安装界面后,输入:f0 rh124

第8步:添加课程

安装成功后,启动,再添加课程:

sudo rht-usb courseusb rh134

sudo rht-usb courseusb rh294

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!