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:Copy to Clipboard Copied! Toggle word wrap Toggle overflow mount -o loop /tmp/rhel-server-7.3-x86_64-dvd.iso /mnt/
# mount -o loop /tmp/rhel-server-7.3-x86_64-dvd.iso /mnt/
- Create a working directory and copy the DVD content to it. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow mkdir /root/rhel-install/ shopt -s dotglob cp -avRf /mnt/* /root/rhel-install/
# mkdir /root/rhel-install/ # shopt -s dotglob # cp -avRf /mnt/* /root/rhel-install/
- Unmount the ISO file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow umount /mnt/
# umount /mnt/
- Copy the Kickstart file generated during the installation to the working directory:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cp /root/anaconda-ks.cfg /root/rhel-install/
# cp /root/anaconda-ks.cfg /root/rhel-install/
- 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:Copy to Clipboard Copied! Toggle word wrap Toggle overflow %post subscription-manager register --auto-attach --username=user_name --password=password %end
%post subscription-manager register --auto-attach --username=user_name --password=password %end
- Display the installation DVD volume name:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow isoinfo -d -i rhel-server-7.3-x86_64-dvd.iso | grep "Volume id" | \ sed -e 's/Volume id: //' -e 's/ /\\x20/g'
# 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
- Add a new menu entry to the boot
/root/rhel-install/isolinux/isolinux.cfg
file that uses the Kickstart file. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow ####################################### 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 #######################################
####################################### 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 #######################################
Note
Set theinst.stage2=hd:LABEL=
andinst.ks=hd:LABEL=
options to the DVD volume name retrieved in the previous 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:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow mount /root/rhel-install/images/efiboot.img /mnt/
# mount /root/rhel-install/images/efiboot.img /mnt/
- Edit the file
/mnt/EFI/BOOT/grub.cfg
: - Add a new menu entry:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ####################################### '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 } #######################################
####################################### '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 } #######################################
- Unmount the volume:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow umount /mnt
# umount /mnt
- 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:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ####################################### '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 } #######################################
####################################### '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 } #######################################
- Create the
/root/rhel-ks.iso
file from the working directory:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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/
# 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/
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:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow isohybrid --uefi /root/rhel-ks.iso
# isohybrid --uefi /root/rhel-ks.iso
- 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”.