User Tools

Site Tools


linux:centos_redhat_kickstart

This is an old revision of the document!


Deployment on CentOS/Redhat from ISO customized (kickstart)

CentOS and Redhat 7 and 8

You can customize the base ISO image to have a personalized installation.

Mount the DVD iso at some location:

# mount -o loop ~/Downloads/rhel-server-8.4-x86_64-dvd.iso /mnt

Then create a directory and copy all the contents of the ISO into the same.

# shopt -s dotglob
# mkdir /tmp/rhel8
# cp -avRf /mnt/* /tmp/rhel8

Note: All files including .<file> must also be copied, else the stage2 won't be loaded.

Copy your kickstart file into the temporary folder (name must be ks.cfg)

# cd /tmp/rhel8
# cp ~/myfiles/ks.cfg /tmp/rhel8/

Into kickstart file, do not specify url or repo section.

If you don't know how to create a kickstart file refer to examples

https://github.com/jivoi/scripts/blob/master/kickstart/ks.cfg

Or use the configurator

https://access.redhat.com/labs/kickstartconfig/

Check the LABEL of the DVD iso.

# blkid ~/Download/rhel-server-8.4-x86_64-dvd.iso 

Add the stanza in /tmp/rhel7/isolinux/isolinux.cfg file as follows.

Make sure that the stanza has inst.stage2 and the correct label.

#######################################
label kickstart
  menu label ^Kickstart Installation of RHEL8.4
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-8.4\x20Server.x86_64 inst.ks=cdrom:/ks.cfg
#######################################

Also modify the file /tmp/rhel8/EFI/BOOT/grub.cfg as follows.

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Install Red Hat Enterprise Linux 8.4' --class fedora --class gnu-linux --class gnu --class os {
    linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-8.4\x20Server.x86_64 inst.ks=cdrom:/ks.cfg
    initrdefi /images/pxeboot/initrd.img
}

Create the ISO file. Be careful, the label must be correct, else CD won't boot. Don't forget the dot at the end of the command

# cd /tmp/rhel8/
# mkisofs -o /tmp/rhel8test.iso -b isolinux/isolinux.bin -J -R -l -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -graft-points -V "RHEL-8.4 Server.x86_64" .

Make your ISO bootable

# isohybrid --uefi /tmp/rhel8test.iso

Note: Difference between 7 and 8

  • kickstart file
  • volume label ID
linux/centos_redhat_kickstart.1629802659.txt.gz · Last modified: 2021/08/24 12:57 by manu