Kickstart based RHEL installation from several ISO files on the one USB stick
Environment
- Red Hat Enterprise Linux (RHEL) 7, 8
- genisoimage
Issue
How to create a universal installation USB
stick containing several RHEL
ISO
releases and several kickstart files.
Resolution
-
Create a
usb_stick
folder that will contain all the necessary files:# mount -o loop RHEL-7.6-20181010.0-Server-x86_64-boot.iso /media/ $ mkdir usb_stick $ cp -a /media/isolinux/ usb_stick $ chmod -R u+w usb_stick
-
Copy all the required
RHEL
ISO
files to theusb_stick
, for example:$ ll usb_stick/*.iso total 12360716 -rw-rw-r-- 1 test test 4203741184 Oct 30 14:33 RHEL-7.0-20140507.0-Workstation-x86_64-dvd1.iso -rw-rw-r-- 1 test test 4497342464 May 13 13:51 RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso -rw-rw-r-- 1 test test 3956277248 Oct 30 14:43 RHEL-7.7-20190723.1-Client-x86_64-dvd1.iso
-
Add menu items to the
usb_stick/isolinux/isolinux.cfg
in order to install the correspondingRHEL
:... label server menu label Install Red Hat Enterprise Linux 7.6 ^Server menu default kernel vmlinuz append initrd=initrd.img inst.ks=hd:LABEL=RHEL7:/server.cfg inst.stage2=hd:LABEL=RHEL7:/RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso label netinstall menu label Install Red Hat Enterprise Linux 7.6 ^Netinstall Server kernel vmlinuz append initrd=initrd.img inst.ks=hd:LABEL=RHEL7:/netinstall.cfg inst.stage2=hd:LABEL=RHEL7:/RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso label client menu label Install Red Hat Enterprise Linux 7.7 ^Client kernel vmlinuz append initrd=initrd.img inst.ks=hd:LABEL=RHEL7:/client.cfg inst.stage2=hd:LABEL=RHEL7:/RHEL-7.7-20190723.1-Client-x86_64-dvd1.iso label desktop menu label Install Red Hat Enterprise Linux 7.0 ^Workstation kernel vmlinuz append initrd=initrd.img inst.ks=hd:LABEL=RHEL7:/workstation.cfg inst.stage2=hd:LABEL=RHEL7:/RHEL-7.0-20140507.0-Workstation-x86_64-dvd1.iso ...
-
Create the appropriate kickstart files (for example
usb_stick/minimal.cfg
):# RHEL7 lang en_US keyboard us timezone Europe/Prague --isUtc rootpw a #platform x86, AMD64, or Intel EM64T reboot text bootloader --location=mbr --append="crashkernel=auto" zerombr clearpart --all --initlabel autopart auth --passalgo=sha512 --useshadow firewall --enabled firstboot --disable network --bootproto=dhcp --onboot=on --ipv6=auto --hostname=test %packages @base %end
The folder for the
USB
stick contains the following files:$ ll usb_stick/ total 44 drwxrwxr-x 4 test test 4096 Oct 30 15:26 . drwxrwxr-x 5 test test 4096 Oct 30 15:05 .. -rw-r--r-- 1 test test 426 Oct 30 14:48 client.cfg drwxr-xr-x 2 test test 4096 Oct 30 15:11 isolinux -rw-r--r-- 1 test test 426 Oct 30 14:48 netinstall.cfg -rw-r--r-- 1 test test 426 Oct 30 14:47 server.cfg -rw-r--r-- 1 test test 426 Oct 30 14:48 workstation.cfg -rw-rw-r-- 1 test test 4203741184 Oct 30 14:33 RHEL-7.0-20140507.0-Workstation-x86_64-dvd1.iso -rw-rw-r-- 1 test test 4497342464 May 13 13:51 RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso -rw-rw-r-- 1 test test 3956277248 Oct 30 14:43 RHEL-7.7-20190723.1-Client-x86_64-dvd1.iso
-
Create the
ISO
image (the commandisohybrid
makesUSB
stick bootable):#!/bin/bash ISO=usb_stick NAME="RHEL7" mkisofs -allow-limited-size -o $ISO.iso \ -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -V "$NAME" \ -boot-load-size 4 -boot-info-table -r -T -J $ISO isohybrid -v $ISO.iso
-
Copy the
usb_stick.iso
to physicalUSB
stick:# dd if=usb_stick.iso of=/dev/<USB stick device name> bs=512k; sync
or
# cat usb_stick.iso > /dev/<USB stick device name>
Disclaimer: Using custom ISO images is not supported; for example if anaconda fails when using a custom ISO image, Red Hat will not be able to help investigate the issue.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments