Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

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

  1. Record an installation in a Kickstart file:
    1. Manually install Red Hat Enterprise Linux once. For details see Section 4.1, “Interactive Installation”.
    2. Boot the installed system. During the installation, Anaconda created a Kickstart file with the settings in the /root/anaconda-ks.cfg file.
  2. Download the Red Hat Enterprise Linux installation DVD ISO file to the /tmp/ directory.
  3. Mount the installation ISO file to the /mnt/ directory. For example:
    # mount -o loop /tmp/rhel-server-7.3-x86_64-dvd.iso /mnt/
  4. Create a working directory and copy the DVD content to it. For example:
    # mkdir /root/rhel-install/
    # shopt -s dotglob
    # cp -avRf /mnt/* /root/rhel-install/
  5. Unmount the ISO file:
    # umount /mnt/
  6. Copy the Kickstart file generated during the installation to the working directory:
    # cp /root/anaconda-ks.cfg /root/rhel-install/
  7. 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:
    %post
    subscription-manager register --auto-attach --username=user_name --password=password
    %end
  8. Display the installation DVD volume name:
    # 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
  9. Add a new menu entry to the boot /root/rhel-install/isolinux/isolinux.cfg file that uses the Kickstart file. For example:
    #######################################
    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 the inst.stage2=hd:LABEL= and inst.ks=hd:LABEL= options to the DVD volume name retrieved in the previous step.
  10. 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:
      1. Mount the volume:
        # mount /root/rhel-install/images/efiboot.img /mnt/
      2. Edit the file /mnt/EFI/BOOT/grub.cfg:
      3. Add a new menu entry:
        #######################################
        '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
        }
        #######################################
      4. Unmount the volume:
         # umount /mnt
    • For a CDROM UEFI boot, follow the steps:
      1. Edit the file /root/rhel-install/EFI/BOOT/grub.cfg:
      2. Add a new menu entry to the file:
        #######################################
        '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
        }
        #######################################
  11. Create the /root/rhel-ks.iso file from the working directory:
    # 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.
  12. Make the ISO image created by the command `mkisofs` bootable:
    # isohybrid --uefi /root/rhel-ks.iso
  13. 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

  1. Select the entry with the Kickstart configuration that you created in Section 4.2, “Automatic Installation”.