Configuring PXE Boot Loading

The steps to configure a PXE boot loader depends on the type of system that's used for the boot server.

Important:

You must use the correct kernel and ram-disk image for the type of installation that you want. For example, if you intend to install a system with a Btrfs root partition, you must use the UEK boot ISO to obtain the correct kernel and image for the system to provide Btrfs.

Configuring PXE Boot Loading for BIOS Clients

  1. Install the syslinux-tftpboot package, which contains the required installation files.

    Run the following command to install syslinux-tftpboot:

    sudo dnf install syslinux-tftpboot -y

    This package writes the pxelinux.0 boot loader and various menu modules to the /tftpboot directory.

  2. Create the pxelinux/pxelinux.cfg directory under the TFTP server directory.

    Run the following command to create the pxelinux/pxelinux.cfg directory:

    sudo mkdir -p /var/lib/tftpboot/pxelinux/pxelinux.cfg
  3. Copy the boot loader and menu modules to the pxelinux subdirectory.

    Run the following command to copy the required files:

    sudo cp -a /tftpboot/. /var/lib/tftpboot/pxelinux
  4. Copy the required installation files to the pxelinux subdirectory.

    From the NFS share directory, copy the installation kernel (vmlinuz), and the ram-disk image file (initrd.img) to the pxelinux subdirectory.

    sudo cp /var/nfs-exports/ISOs/ol10/vmlinuz /var/lib/tftpboot/pxelinux/vmlinuz
    sudo cp /var/nfs-exports/ISOs/ol10/initrd.img /var/lib/tftpboot/pxelinux/initrd.img
  5. In the pxelinux.cfg subdirectory, create a PXE menu configuration file.

    You can assign any name to the file, such as pxe.conf. The following example shows typical entries in the file:

    MENU TITLE  PXE Server 
    NOESCAPE 1
    ALLOWOPTIONS 1
    PROMPT 0
    menu width 80
    menu rows 14
    MENU TABMSGROW 24
    MENU MARGIN 10
    menu color border               30;44      #ffffffff #00000000 std
  6. Create the pxelinux.cfg/default PXE configuration file.

    The following example shows typical entries in the file:

    DEFAULT vesamenu.c32
    TIMEOUT 400
    ONTIMEOUT BootLocal
    PROMPT 0
    MENU INCLUDE pxelinux.cfg/pxe.conf
    NOESCAPE 1
    LABEL BootLocal
        localboot 0
        TEXT HELP
        Boot to local hard disk
        ENDTEXT
    
    LABEL OL10
        MENU LABEL OL10 
        kernel vmlinuz
        append initrd=initrd.img inst.repo=/var/nfs-exports/ISOs/ol10/ \
        inst.ks.sendmac inst.ks=/var/nfs-exports/ISOs/ksfiles/kstart-file
        TEXT HELP
        Install Oracle Linux 10   
        ENDTEXT
    Based on these entries, the boot loader would automatically try to boot from the local drive if no user intervention occurs during the TIMEOUT period. If no OS is installed, then the boot loader would boot from the network and start the installation process.

    This list explains some directives used in the configuration file:

    • DEFAULT identifies the module you want to use for displaying the boot loader menu.

      For a basic text UI, specify the menu.c32 module. However, if you add directives for a graphical UI (such as images and colors), then specify the vesamenu.c32 module instead.

    • TIMEOUT specifies the period in timeout/10 seconds before the boot loader boots the client according to the subsequent directives. The next directive (ontimeout) specifies the action when the wait period expires.

    • PROMPT specifies whether the boot: prompt is displayed by default. If PROMPT is set to 1, the boot: prompt is displayed. If PROMPT is set to 0, the boot: prompt isn't displayed unless the user presses the Shift or Alt key at the console.

    • MENU INCLUDE supplies the path to the boot configuration file you created.

    • kernel defines the name of the kernel executable.

    • append defines any parameters to append when loading the kernel, such as the name of the ram-disk image and the location of a file. Note that the inst.repo variable can be set to point to the BaseOS repository on the Oracle Linux yum server if the system has access to the Internet. For example, inst.repo can be set to https://yum.oracle.com/repo/OracleLinux/OL10/baseos/latest/x86_64 for an x86_64 platform system.

      Important:

      The kernel and ram-disk image file paths are assumed to be relative to the subdirectory that contains the boot loader, such as pxelinux. If you place the vmlinuz and initrd.img files in a subdirectory such as pxelinux/OL10, ensure you have the correct relative paths.

Configuring PXE Boot Loading for UEFI Clients

  1. Download the grub2-efi and shim packages.

    Create a temporary directory and then download the required packages:

    mkdir /tmp/boot_rpms
    sudo dnf download shim grub2-efi --downloaddir=/tmp/boot_rpms
  2. Go to the package location and extract their contents.

    Run the following commands to extract the contents of the grub2-efi and shim packages:

    cd /tmp/boot_rpms
    sudo rpm2cpio grub2-efi-version.rpm | cpio -idmv 
    sudo rpm2cpio shim-version.rpm | cpio -idmv
  3. Create a subdirectory under the TFTP server directory.

    For example, the following command creates the efi subdirectory under /var/lib/tftpboot:

    sudo mkdir -p /var/lib/tftpboot/efi
  4. Copy the boot loader and other related files to the efi subdirectory.

    Run the following command to copy the required files to /var/lib/tftpboot/efi:

    sudo cp /tmp/boot_rpms/boot/efi/EFI/redhat/grubx64.efi /var/lib/tftpboot/efi
    sudo cp /tmp/boot_rpms/boot/efi/EFI/redhat/shim*.efi /var/lib/tftpboot/efi
    sudo cp /tmp/boot_rpms/boot/efi/EFI/redhat/MokManager.efi /var/lib/tftpboot/efi

    Note:

    The shim.efi and MokManager.efi files are needed to support Secure Boot on clients. The MokManager.efi provides utilities for managing the keys used to sign EFI binaries. As a passthrough boot loader, you would then specify shim.efi when setting dhcp-boot for UEFI-based clients in the /etc/dnsmasq.conf file. See Configuring dnsmasq.

  5. From the NFS share directory, copy the installation kernel (vmlinuz) and the ram-disk image file (initrd.img) to the efi subdirectory.

    Run the following commands to copu the required files to /var/lib/tftpboot/efi:

    sudo cp /var/nfs-exports/ISOs/ol10/vmlinuz -O /var/lib/tftpboot/efi/vmlinuz
    sudo cp /var/nfs-exports/ISOs/ol10/initrd.img /var/lib/tftpboot/efi/initrd.img
  6. Create the /var/lib/tftpboot/efi/grub.cfg boot loader configuration file.

    The configuration file includes the options for booting from the network and for booting locally. The client boots from the network to begin the installation process. Then after the client reboots at the end of the installation, the system boots from the local drive.

    The following example shows typical entries in the file:

    set default 0
    set timeout=10
    
    menuentry 'ol10 localboot' {
    echo "Booting from local disk"
    set root=(hd0,gpt1)
    chainloader efi/shim.efi
    boot
    }
    
    menuentry 'ol10' {
      echo "Loading vmlinuz"
      linuxefi vmlinuz inst.repo=/var/nfs-exports/ISOs/ol10/ inst.ks.sendmac \
      inst.ks=/var/nfs-exports/ISOs/ksfiles/kstart-file
      echo "Loading /initrd.img"
      initrdefi initrd.img
      echo "Booting installation kernel"
    }

    Caution:

    Boot loader configuration isn't uniform across UEFI-based systems. Because of variables such as differing disk layout, a specific boot loader setup doesn't universally apply to all systems. The previous example illustrates only one way of configuring the boot loader. You must create boot loader configurations appropriate to the systems that you're setting up.

    • linuxefi defines the name of the kernel executable and any parameters to append when loading the kernel, such as the location of the installation packages and the location of a file.

    • initrdefi defines the name of the ram-disk image.

    Important:

    The kernel and ram-disk image file paths are assumed to be relative to the subdirectory that contains the boot loader, such as efi. If you place the vmlinuz and initrd.img files in a subdirectory, such as efi/OL10, ensure you have the correct relative paths.