RHEL/CentOS 7: Deploying a System Using a Custom Boot ISO File

0
43

PXE is a widely used way to deploy systems, and so are ISO’s. PXE may not always be at hand because of security, hardware availability, and so on.

Many hardware manufacturers provide remote access to their systems without an OS installed. HP has iLO, while Dell has RIB. The advantage of these “remote” control solutions is that they also allow you to mount “virtual” media in the form of an ISO.

Red Hat provides boot media as ISO images, which you can use to boot your systems from. We will create a custom ISO image, which will allow us to boot a system in a similar way.

Let’s create an ISO that you can mount as virtual media, write a CD-ROM, or even use dd to write the contents on a USB stick/disk through the following steps:

  1. Install the required packages to create ISO9660 images, as follows:
    ~]# yum install -y genisoimage
    
  2. Mount the RHEL 7 DVD’s ISO image by executing the following command:
    ~]# mount -o loop /path/to/rhel-server-7.0-x86_64-dvd.iso /mnt
    
  3. Copy the required files for the custom ISO from the RHEL 7 media via the following commands:
    ~]# mkdir -p /root/iso
    ~]# cp -r /mnt/isolinux /root/iso
    ~]# umount /mnt
    
  4. Now, unmount the RHEL 7 DVD’s ISO image by running the following:
    ~]# umount /mnt
    
  5. Next, remove the isolinux.cfg file using the following command:
    ~]# rm -f /root/iso/isolinux/isolinux.cfg
    
  6. Create a new isolinux.cfg file, as follows:
    default vesamenu.c32
    timeout 600
    display boot.msg
    menu clear
    menu background splash.png
    menu title Red Hat Enterprise Linux 7.0
    menu vshift 8
    menu rows 18
    menu margin 8
    menu helpmsgrow 15
    menu tabmsgrow 13
    menu color sel 0 #ffffffff #00000000 none
    menu color title 0 #ffcc000000 #00000000 none
    menu color tabmsg 0 #84cc0000 #00000000 none
    menu color hotsel 0 #84cc0000 #00000000 none
    menu color hotkey 0 #ffffffff #00000000 none
    menu color cmdmark 0 #84b8ffff #00000000 none
    menu color cmdline 0 #ffffffff #00000000 none
    label linux
      menu label ^Install Red Hat Enterprise Linux 7.0
      kernel vmlinuz
      append initrd=initrd.img ks=http://kickstart.critter.be/kickstart.ks text
    
    label local
      menu label Boot from ^local drive
      localboot 0xffff
    
    menu end
  7. Now, create the ISO by executing the following command:
    ~]# cd /root/iso
    ~/iso]# mkisofs -o ../boot.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -r .
    

    More information on the options used with the mkisofs command can be found in the man pages for mkisofs(1).

    The following image shows the progress on creating a custom ISO:

custom-boot-iso-1

Then, use the ISO to install a guest on a KVM server, as shown in the following commands:

~]# virsh vol-create-as --pool localfs-vm --name rhel7_guest-da.qcows2 --format qcows2 –capacity 10G
~]# virt-install \
--hvm \
--name rhel7_guest \
–-memory 2G,maxmemory=4G \
--vcpus 2,max=4 \
--os-type linux \
--os-variant rhel7 \
--boot hd,cdrom,network,menu=on \
--controller type=scsi,model=virtio-scsi \
--disk device=cdrom,vol=iso/boot.iso,readonly=on,bus=scsi \
--disk device=disk,vol=localfs-vm/rhel7_guest-vda.qcow2,cache=none,bus=scsi \
--network network=bridge-eth0,model=virtio \
--graphics vnc \
--graphics spice \
--noautoconsole \
--memballoon virtio

The following screenshot shows the console when booted with the custom ISO image:

 custom-boot-iso-2

Using the RHEL 7 installation media, we created a new boot ISO that allows us to install a new system. The ISO can be used to either burn a CD, with the dd tool to be copied on a USB stick, or to mount as virtual media. The way to mount this ISO as virtual media is different on each hardware platform, so this tutorial shows you how to install it using KVM.

LEAVE A REPLY

Please enter your comment!
Please enter your name here