Chapter 14. Preparing to install from the network using PXE

This section describes how to configure TFTP and DHCP on a PXE server to enable PXE boot and network installation.

14.1. Network install overview

A network installation allows you to install Red Hat Enterprise Linux to a system that has access to an installation server. At a minimum, two systems are required for a network installation:

PXE Server: A system running a DHCP server, a TFTP server, and an HTTP, HTTPS, FTP, or NFS server. While each server can run on a different physical system, the procedures in this section assume a single system is running all servers.

Client: The system to which you are installing Red Hat Enterprise Linux. Once installation starts, the client queries the DHCP server, receives the boot files from the TFTP server, and downloads the installation image from the HTTP, HTTPS, FTP or NFS server. Unlike other installation methods, the client does not require any physical boot media for the installation to start.

Note

To boot a client from the network, configure it in BIOS/UEFI or a quick boot menu. On some hardware, the option to boot from a network might be disabled, or not available.

The workflow steps to prepare to install Red Hat Enterprise Linux from a network using PXE are as follows:

Steps

  1. Export the installation ISO image or the installation tree to an NFS, HTTPS, HTTP, or FTP server.
  2. Configure the TFTP server and DHCP server, and start the TFTP service on the PXE server.
  3. Boot the client and start the installation.
Important

The GRUB2 boot loader supports a network boot from HTTP in addition to a TFTP server. Sending the boot files, which are the kernel and initial RAM disk vmlinuz and initrd, over this protocol might be slow and result in timeout failures. An HTTP server does not carry this risk, but it is recommended that you use a TFTP server when sending the boot files.

Additional resources

14.2. Configuring a TFTP server for BIOS-based clients

Use this procedure to configure a TFTP server and DHCP server and start the TFTP service on the PXE server for BIOS-based AMD and Intel 64-bit systems.

Important

All configuration files in this section are examples. Configuration details vary and are dependent on the architecture and specific requirements.

Procedure

  1. As root, install the following packages:

    # yum install tftp-server dhcp-server
  2. Allow incoming connections to the tftp service in the firewall:

    # firewall-cmd --add-service=tftp
    Note
    • This command enables temporary access until the next server reboot. To enable permanent access, add the --permanent option to the command.
    • Depending on the location of the installation ISO file, you might have to allow incoming connections for HTTP or other services.
  3. Configure your DHCP server to use the boot images packaged with SYSLINUX as shown in the following example /etc/dhcp/dhcpd.conf file:

    option space pxelinux;
    option pxelinux.magic code 208 = string;
    option pxelinux.configfile code 209 = text;
    option pxelinux.pathprefix code 210 = text;
    option pxelinux.reboottime code 211 = unsigned integer 32;
    option architecture-type code 93 = unsigned integer 16;
    
    subnet 10.0.0.0 netmask 255.255.255.0 {
    	option routers 10.0.0.254;
    	range 10.0.0.2 10.0.0.253;
    
    	class "pxeclients" {
    	  match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
    	  next-server 10.0.0.1;
    
    	  if option architecture-type = 00:07 {
    	    filename "uefi/shim.efi";
    	    } else {
    	    filename "pxelinux/pxelinux.0";
    	  }
    	}
    }
  4. Access the pxelinux.0 file from the SYSLINUX package in the Binary DVD ISO image file, where my_local_directory is the name of the directory that you create:

    # mount -t iso9660 /path_to_image/name_of_image.iso /mount_point -o loop,ro
    # cp -pr /mount_point/BaseOS/Packages/syslinux-tftpboot-version-architecture.rpm /my_local_directory
    # umount /mount_point
  5. Extract the package:

    # rpm2cpio syslinux-tftpboot-version-architecture.rpm | cpio -dimv
  6. Create a pxelinux/ directory in tftpboot/ and copy all the files from the directory into the pxelinux/ directory:

    # mkdir /var/lib/tftpboot/pxelinux
    # cp my_local_directory/tftpboot/* /var/lib/tftpboot/pxelinux
  7. Create the directory pxelinux.cfg/ in the pxelinux/ directory:

    # mkdir /var/lib/tftpboot/pxelinux/pxelinux.cfg
  8. Add a default configuration file to the pxelinux.cfg/ directory as shown in the following example:

    default vesamenu.c32
    prompt 1
    timeout 600
    
    display boot.msg
    
    label linux
      menu label ^Install system
      menu default
      kernel images/RHEL-8.1/vmlinuz
      append initrd=images/RHEL-8.1/initrd.img ip=dhcp inst.repo=http://10.32.5.1/RHEL-8.1/x86_64/iso-contents-root/
    label vesa
      menu label Install system with ^basic video driver
      kernel images/RHEL-8.1/vmlinuz
      append initrd=images/RHEL-8.1/initrd.img ip=dhcp inst.xdriver=vesa nomodeset inst.repo=http://10.32.5.1/RHEL-8.1/x86_64/iso-contents-root/
    label rescue
      menu label ^Rescue installed system
      kernel images/RHEL-8.1/vmlinuz
      append initrd=images/RHEL-8.1/initrd.img rescue
    label local
      menu label Boot from ^local drive
      localboot 0xffff
    Note
    • The installation program cannot boot without its runtime image. Use the inst.stage2 boot option to specify location of the image. Alternatively, you can use the inst.repo= option to specify the image as well as the installation source.
    • The installation source location used with inst.repo must contain a valid .treeinfo file.
    • When you select the RHEL8 installation DVD as the installation source, the .treeinfo file points to the BaseOS and the AppStream repositories. You can use a single inst.repo option to load both repositories.
  9. Create a subdirectory to store the boot image files in the /var/lib/tftpboot/ directory, and copy the boot image files to the directory. In this example, the directory is /var/lib/tftpboot/pxelinux/images/RHEL-8.1/:

    # mkdir -p /var/lib/tftpboot/pxelinux/images/RHEL-8.1/
    # cp /path_to_x86_64_images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/images/RHEL-8.1/
  10. Start and enable the dhcpd service:

    # systemctl start dhcpd
    # systemctl enable dhcpd
  11. Start and enable the tftp.socket service:

    # systemctl start tftp.socket
    # systemctl enable tftp.socket

    The PXE boot server is now ready to serve PXE clients. You can start the client, which is the system to which you are installing Red Hat Enterprise Linux, select PXE Boot when prompted to specify a boot source, and start the network installation.

14.3. Configuring a TFTP server for UEFI-based clients

Use this procedure to configure a TFTP server and DHCP server and start the TFTP service on the PXE server for UEFI-based AMD64, Intel 64, and 64-bit ARM systems.

Important
  • All configuration files in this section are examples. Configuration details vary and are dependent on the architecture and specific requirements.
  • Red Hat Enterprise Linux 8 UEFI PXE boot supports a lowercase file format for a MAC-based grub menu file. For example, the MAC address file format for grub2 is grub.cfg-01-aa-bb-cc-dd-ee-ff

Procedure

  1. As root, install the following packages:

    # yum install tftp-server dhcp-server
  2. Allow incoming connections to the tftp service in the firewall:

    # firewall-cmd --add-service=tftp
    Note
    • This command enables temporary access until the next server reboot. To enable permanent access, add the --permanent option to the command.
    • Depending on the location of the installation ISO file, you might have to allow incoming connections for HTTP or other services.
  3. Configure your DHCP server to use the boot images packaged with shim as shown in the following example /etc/dhcp/dhcpd.conf file:

    option space pxelinux;
    option pxelinux.magic code 208 = string;
    option pxelinux.configfile code 209 = text;
    option pxelinux.pathprefix code 210 = text;
    option pxelinux.reboottime code 211 = unsigned integer 32;
    option architecture-type code 93 = unsigned integer 16;
    
    subnet 10.0.0.0 netmask 255.255.255.0 {
    	option routers 10.0.0.254;
    	range 10.0.0.2 10.0.0.253;
    
    	class "pxeclients" {
    	  match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
    	  next-server 10.0.0.1;
    
    	  if option architecture-type = 00:07 {
    	    filename "BOOTX64.efi";
    	  } else {
    	    filename "pxelinux/pxelinux.0";
    		}
      }
    }
  4. Access the BOOTX64.efi file from the shim package, and the grubx64.efi file from the grub2-efi package in the Binary DVD ISO image file where my_local_directory is the name of the directory that you create:

    # mount -t iso9660 /path_to_image/name_of_image.iso /mount_point -o loop,ro
    # cp -pr /mount_point/BaseOS/Packages/shim-version-architecture.rpm /my_local_directory
    # cp -pr /mount_point/BaseOS/Packages/grub2-efi-version-architecture.rpm /my_local_directory
    # umount /mount_point
  5. Extract the packages:

    # rpm2cpio shim-version-architecture.rpm | cpio -dimv
    # rpm2cpio grub2-efi-version-architecture.rpm | cpio -dimv
  6. Copy the EFI boot images from your boot directory. Replace ARCH with shim or grub followed by the architecture, for example, grubx64.

    # cp my_local_directory/boot/efi/EFI/redhat/ARCH.efi /var/lib/tftpboot/uefi/
    # cp my_local_directory/boot/efi/EFI/redhat/ARCH.efi /var/lib/tftpboot/uefi
  7. Add a configuration file named grub.cfg to the tftpboot/ directory as shown in the following example:

    set timeout=60
    menuentry 'RHEL 8' {
      linuxefi images/RHEL-8.1/vmlinuz ip=dhcp inst.repo=http://10.32.5.1/RHEL-8.1/x86_64/iso-contents-root/
      initrdefi images/RHEL-8.1/initrd.img
    }
    Note
    • The installation program cannot boot without its runtime image. Use the inst.stage2 boot option to specify location of the image. Alternatively, you can use the inst.repo= option to specify the image as well as the installation source.
    • The installation source location used with inst.repo must contain a valid .treeinfo file.
    • When you select the RHEL8 installation DVD as the installation source, the .treeinfo file points to the BaseOS and the AppStream repositories. You can use a single inst.repo option to load both repositories.
  8. Create a subdirectory to store the boot image files in the /var/lib/tftpboot/ directory, and copy the boot image files to the directory. In this example, the directory is /var/lib/tftpboot/images/RHEL-8.1/:

    # mkdir -p /var/lib/tftpboot/images/RHEL-8.1/
    # cp /path_to_x86_64_images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/images/RHEL-8.1/
  9. Start and enable the dhcpd service:

    # systemctl start dhcpd
    # systemctl enable dhcpd
  10. Start and enable the tftp.socket service:

    # systemctl start tftp.socket
    # systemctl enable tftp.socket

    The PXE boot server is now ready to serve PXE clients. You can start the client, which is the system to which you are installing Red Hat Enterprise Linux, select PXE Boot when prompted to specify a boot source, and start the network installation.

Additional resources

14.4. Configuring a network server for IBM Power systems

Use this procedure to configure a network boot server for IBM Power systems using GRUB2.

Important

All configuration files in this section are examples. Configuration details vary and are dependent on the architecture and specific requirements.

Procedure

  1. As root, install the following packages:

    # yum install tftp-server dhcp-server
  2. Allow incoming connections to the tftp service in the firewall:

    # firewall-cmd --add-service=tftp
    Note
    • This command enables temporary access until the next server reboot. To enable permanent access, add the --permanent option to the command.
    • Depending on the location of the installation ISO file, you might have to allow incoming connections for HTTP or other services.
  3. Create a GRUB2 network boot directory inside the tftp root:

    # grub2-mknetdir --net-directory=/var/lib/tftpboot
    Netboot directory for powerpc-ieee1275 created. Configure your DHCP server to point to /boot/grub2/powerpc-ieee1275/core.elf
    Note

    The command output informs you of the file name that needs to be configured in your DHCP configuration, described in this procedure.

    1. If the PXE server runs on an x86 machine, the grub2-ppc64-modules must be installed before creating a GRUB2 network boot directory inside the tftp root:

      # yum install grub2-ppc64-modules
  4. Create a GRUB2 configuration file: /var/lib/tftpboot/boot/grub2/grub.cfg as shown in the following example:

    set default=0
    set timeout=5
    
    echo -e "\nWelcome to the Red Hat Enterprise Linux 8 installer!\n\n"
    
    menuentry 'Red Hat Enterprise Linux 8' {
      linux grub2-ppc64/vmlinuz ro ip=dhcp inst.repo=http://10.32.5.1/RHEL-8.1/x86_64/iso-contents-root/
      initrd grub2-ppc64/initrd.img
    }
    Note
    • The installation program cannot boot without its runtime image. Use the inst.stage2 boot option to specify location of the image. Alternatively, you can use the inst.repo= option to specify the image as well as the installation source.
    • The installation source location used with inst.repo must contain a valid .treeinfo file.
    • When you select the RHEL8 installation DVD as the installation source, the .treeinfo file points to the BaseOS and the AppStream repositories. You can use a single inst.repo option to load both repositories.
  5. Mount the Binary DVD ISO image using the command:

    # mount -t iso9660 /path_to_image/name_of_iso/ /mount_point -o loop,ro
  6. Create a directory and copy the initrd.img and vmlinuz files from Binary DVD ISO image into it, for example:

    # cp /mount_point/ppc/ppc64/{initrd.img,vmlinuz} /var/lib/tftpboot/grub2-ppc64/
  7. Configure your DHCP server to use the boot images packaged with GRUB2 as shown in the following example:

    subnet 192.168.0.1 netmask 255.255.255.0 {
      allow bootp;
      option routers 192.168.0.5;
      group { #BOOTP POWER clients
        filename "boot/grub2/powerpc-ieee1275/core.elf";
        host client1 {
        hardware ethernet 01:23:45:67:89:ab;
        fixed-address 192.168.0.112;
        }
      }
    }
  8. Adjust the sample parameters subnet, netmask, routers, fixed-address and hardware ethernet to fit your network configuration. Note the file name parameter; this is the file name that was outputted by the grub2-mknetdir command earlier in this procedure.
  9. Start and enable the dhcpd service:

    # systemctl start dhcpd
    # systemctl enable dhcpd
  10. Start and enable the tftp.socket service:

    # systemctl start tftp.socket
    # systemctl enable tftp.socket

    The PXE boot server is now ready to serve PXE clients. You can start the client, which is the system to which you are installing Red Hat Enterprise Linux, select PXE Boot when prompted to specify a boot source, and start the network installation.