4.2. Automatic Installation This section describes a simple procedure on how to add a Kickstart file to the installation USB drive, which automatically installs and registers Red Hat Enterprise Linux. You can use this procedure to deploy Red Hat Enterprise Linux on multiple machines. Generating the USB Boot Media Record an installation in a Kickstart file: Manually install Red Hat Enterprise Linux once. For details see Section 4.1, "Interactive Installation" . Boot the installed system. During the installation, Anaconda created a Kickstart file with the settings in the /root/anaconda-ks.cfg file. Download the Red Hat Enterprise Linux installation DVD ISO file to the /tmp/ directory. Mount the installation ISO file to the /mnt/ directory. For example: Create a working directory and copy the DVD content to it. For example: Unmount the ISO file: Copy the Kickstart file generated during the installation to the working directory: To register Red Hat Enterprise Linux after the installation automatically and attach a subscription, append the following to the /root/rhel-install/anaconda-ks.cfg file: Display the installation DVD volume name: Add a new menu entry to the boot /root/rhel-install/isolinux/isolinux.cfg file that uses the Kickstart file. For example: Note Set the inst.stage2=hd:LABEL= and inst.ks=hd:LABEL= options to the DVD volume name retrieved in the step. Before you create the /root/rhel-ks.iso file from the working directory, execute the following steps for a USB UEFI boot or for a CDROM UEFI boot : For a USB UEFI boot , follow the steps: Mount the volume: Edit the file /mnt/EFI/BOOT/grub.cfg : Add a new menu entry: Unmount the volume: For a CDROM UEFI boot , follow the steps: Edit the file /root/rhel-install/EFI/BOOT/grub.cfg : Add a new menu entry to the file: Create the /root/rhel-ks.iso file from the working directory: Note Set the -V option to the DVD volume name retrieved in an earlier step and replace \x20 in the string with a space. Make the ISO image created by the command `mkisofs` bootable: Create an installation USB drive. For details, see Section 3.2.1, "Making Installation USB Media on Linux" . Install Red Hat Enterprise Linux Using the Kickstart File Boot the installation USB drive. See Chapter 7, Booting the Installation on 64-bit AMD, Intel, and ARM systems . Select the entry with the Kickstart configuration that you created in Section 4.2, "Automatic Installation" .

Commands:
mount -o loop /tmp/rhel-server-7.3-x86_64-dvd.iso /mnt/
mkdir /root/rhel-install/ shopt -s dotglob cp -avRf /mnt/* /root/rhel-install/
umount /mnt/
cp /root/anaconda-ks.cfg /root/rhel-install/
%post subscription-manager register --auto-attach --username= user_name --password= password %end
isoinfo -d -i rhel-server-7.3-x86_64-dvd.iso | grep "Volume id" | sed -e 's/Volume id: //' -e 's/ /\\x20/g' RHEL-7.3\x20Server.x86_64
####################################### label kickstart menu label ^Kickstart Installation of RHEL7.3 kernel vmlinuz append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.3\x20Server.x86_64 inst.ks=hd:LABEL=RHEL-7.3\x20Server.x86_64:/anaconda-ks.cfg #######################################
mount /root/rhel-install/images/efiboot.img /mnt/
####################################### 'Kickstart Installation of RHEL-7.3' --class fedora --class gnu-linux --class gnu --class os { linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.3\x20Server.x86_64 inst.ks=hd:LABEL=RHEL-7.3\x20Server.x86_64:/anaconda-ks.cfg initrdefi /images/pxeboot/initrd.img } #######################################
umount /mnt
####################################### 'Kickstart Installation of RHEL-7.3' --class fedora --class gnu-linux --class gnu --class os { linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.3\x20Server.x86_64 inst.ks=hd:LABEL=RHEL-7.3\x20Server.x86_64:/anaconda-ks.cfg initrdefi /images/pxeboot/initrd.img } #######################################
mkisofs -untranslated-filenames -volid "RHEL-7.3 Server.x86_64" -J -joliet-long -rational-rock -translation-table -input-charset utf-8 -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -o /root/rhel-ks.iso -graft-points /root/rhel-install/
isohybrid --uefi /root/rhel-ks.iso