Install OS via PXE Boot Environment

This guide will walk you through installing the desired OS on your physical hosts and testing that the OS installation was successful. You will use your PXE boot environment and all other components that you previously set up.

Important

After the OS installation completes, to be able to boot from disk on next power on without changing the boot order of your machine, delete the host-specific PXELINUX configuration file. If you want to re-deploy the physical host, re-create the file and reboot it.

What You’ll Need

Procedure

  1. Power on your physical host.

  2. Wait for the OS installation to complete on your physical host.

    Step-by-Step Analysis

    1. HOST: The PXE-enabled NIC with MAC address aa:8c:dc:40:33:e1 broadcasts a DHCPDISCOVER on the network, which includes a list of information the client would like from the DHCP server and some information identifying itself as a PXE capable device.

    2. DHCP server: Reply with a DHCPOFFER providing the IP address based on the NIC’s MAC, in our case 192.168.2.51. Optionally, it can also provide the gateway address, the subnet and netmask, and DNS name.

      Example logs

      root@host:~# tail -f /var/log/syslog ... May 9 16:02:48 host dnsmasq-dhcp[31710]: DHCPDISCOVER(eth0) aa:8c:dc:40:33:e1 May 9 16:02:48 host dnsmasq-dhcp[31710]: DHCPOFFER(eth0) 192.168.2.51 aa:8c:dc:40:33:e1 May 9 16:02:48 host dnsmasq-dhcp[31710]: DHCPREQUEST(eth0) 192.168.2.51 aa:8c:dc:40:33:e1 May 9 16:02:48 host dnsmasq-dhcp[31710]: DHCPACK(eth0) 192.168.2.51 aa:8c:dc:40:33:e1 node1
    3. proxyDHCP server: Reply with DHCPOFFER providing the next-server-name (192.168.2.10) and boot file name (pxelinux.0) values, which are used by the client during the upcoming TFTP transaction.

      Example logs

      root@host:~# tail -f /var/log/syslog ... May 9 16:02:48 host dnsmasq-dhcp[11574]: 0 PXE(eth0) 192.168.2.51 aa:8c:dc:40:33:e1 pxelinux.0 May 9 16:02:48 host dnsmasq-dhcp[11574]: 0 bootfile name: pxelinux.0 May 9 16:02:48 host dnsmasq-dhcp[11574]: 0 next server: 192.168.2.10
    4. HOST: Make a DHCPREQUEST with the offered IP address.

    5. DHCP/proxyDHCP server: Reply with a DHCPACK, letting the client know it can use the IP configuration information it requested.

    6. HOST: The PXE client now has its IP configuration information, TFTP server name, and boot file name.

    7. HOST: Initiate a TFTP transaction with the TFTP server, 192.168.2.10, to download the bootfile, pxelinux.0.

    8. TFTP server: Serve pxelinux.0 and ldlinux.c32 under TFTP root /var/lib/tftpboot.

      Example logs

      root@host:~# tail -f /var/log/syslog ... Apr 29 19:54:33 host dnsmasq-tftp[32682]: sent /var/lib/tftpboot/pxelinux.0 to 192.168.2.51 Apr 29 19:54:33 host dnsmasq-tftp[32682]: sent /var/lib/tftpboot/ldlinux.c32 to 192.168.2.51
    9. HOST: PXELINUX will try find the host-specific configuration file on the TFTP server based on its MAC. It will try /pxelinux.cfg/01-aa-8c-dc-40-33-e1.

    10. TFTP server: Serve /pxelinux.cfg/01-aa-8c-dc-40-33-e1 under TFTP root /var/lib/tftpboot.

      Example logs

      root@host:~# tail -f /var/log/syslog ... Apr 29 19:54:33 host dnsmasq-tftp[32682]: file /var/lib/tftpboot/pxelinux.cfg/08cff01a-8a71-ba42-868c-5fa245ae4d78 not found Apr 29 19:54:33 host dnsmasq-tftp[32682]: sent /var/lib/tftpboot/pxelinux.cfg/01-aa-8c-dc-40-33-e1 to 192.168.2.51
    11. HOST: PXELINUX will load the configuration that points to the kernel and initramfs to use. It will try fetch /Rocky8/vmlinuz and /Rocky8/initrd.img from TFTP server.

    12. TFTP server: Serve /Rocky8/vmlinuz and /Rocky8/initrd.img from under TFTP root /var/lib/tftpboot.

      Example logs

      root@host:~# tail -f /var/log/syslog ... Apr 29 19:54:52 host dnsmasq-tftp[32682]: sent /var/lib/tftpboot/Rocky8/vmlinuz to 192.168.2.51 Apr 29 19:54:57 host dnsmasq-tftp[32682]: sent /var/lib/tftpboot/Rocky8/initrd.img to 192.168.2.51
    13. HOST: PXELINUX loads the kernel and initramfs and boots the machine. Initramfs scripts will check for /proc/cmdline options, inst.repo, and inst.ks and start the installer.

    14. HOST: The installer will fetch the installation media and the host-specific OS configuration file from the HTTP server.

    15. HTTP server: Serve /iso/Rocky8 and /conf/node1.cfg under /var/www/html.

      Example logs

      root@host:~# tail -f /var/log/lighttpd/access.log 192.168.2.51 192.168.2.10 - [09/May/2022:16:03:54 +0300] "GET /conf/node1.cfg HTTP/1.1" 200 1423 "-" "curl/7.61.1" 192.168.2.51 192.168.2.10 - [09/May/2022:16:04:42 +0300] "GET /iso/Rocky8/.treeinfo HTTP/1.1" 200 1491 "-" "Rocky Linux (anaconda)/8" 192.168.2.51 192.168.2.10 - [09/May/2022:16:04:43 +0300] "GET /iso/Rocky8/Minimal/repodata/repomd.xml HTTP/1.1" 200 3926 "-" "libdnf (Rocky Linux 8.5; generic; Linux.x86_64)"
    16. HOST: The installer completes the OS configuration and fetches the initial SSH authorized keys from the HTTP server.

    17. HTTP server: Serve /files/initial_authorized_keys under /var/www/html.

      Example logs

      root@host:~# tail -f /var/log/lighttpd/access.log ... 192.168.2.51 192.168.2.10 - [09/May/2022:16:09:35 +0300] "GET /files/initial_authorized_keys HTTP/1.1" 200 1489 "-" "curl/7.61.1"
    18. HOST: The installer powers off the physical host.

  3. Go to your bootstrap host (TFTP server) and delete the host-specific PXE configuration file. For example, for host with MAC address 01-aa-8c-dc-40-33-e1, delete the file /var/lib/tftpboot/pxelinux.cfg/01-aa-8c-dc-40-33-e1. This will allow the physical host to boot from the local disk instead from the network upon next power on and subsequent reboots.

Verify

  1. Power on your physical host and wait for it to become up and running.

  2. Connect to your physical host via SSH:

    root@host:~# ssh root@<IP>

    Replace <IP> with the IP address of your physical host, for example:

    root@host:~# ssh root@192.168.2.51
  3. Check the OS release. Choose base on your desired OS:

    [root@node1 ~]# cat /etc/os-release NAME="Rocky Linux" VERSION="8.5 (Green Obsidian)" ID="rocky" ID_LIKE="rhel centos fedora" VERSION_ID="8.5" PLATFORM_ID="platform:el8" PRETTY_NAME="Rocky Linux 8.5 (Green Obsidian)" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:rocky:rocky:8.5:GA" HOME_URL="https://rockylinux.org/" BUG_REPORT_URL="https://bugs.rockylinux.org/" ROCKY_SUPPORT_PRODUCT="Rocky Linux" ROCKY_SUPPORT_PRODUCT_VERSION="8"

Summary

You have successfully installed your desired OS on your physical hosts via your PXE boot environment.

What’s Next

The next step is to install Kubernetes on your physical hosts.