It is a fairly straightforward and simple process to boot a server and install Ubuntu using PXE (Preboot eXecution Environment).

Here’s a list of things needed:

  • Obviously, the computer with PXE-enabled BIOS onto which Ubuntu is to be installed. In PXE terms, this computer is called a PXE client.
  • Another computer with an Ethernet port running a fresh version of Ubuntu. This will be our PXE server.
  • An Ethernet patch cable.
  • Internet access.

PXE uses a combination of two standard protocols, DHCP and TFTP (TFTP is a UDP-based protocol not to be confused with FTP).

Let’s install the required packages on the PXE server:

# apt-get install -y tftpd-hpa isc-dhcp-server

Now download the latest Ubuntu Server ISO image and mount the netboot directory from inside the image at /var/lib/tftpboot:

# mount -o loop,ro ubuntu-17.04-server-amd64.iso /mnt/

# mount --bind /mnt/install/netboot /var/lib/tftpboot

Let’s restart the TFTP server in case it has cached the previous directory contents:

# systemctl restart tftpd-hpa

The TFTP server is now configured and ready for use. On to the DHCP server.

Because we’ll be starting a DHCP server, in order not to disturb any LAN participants, let’s connect the PXE client and server together using a patch cable. A regular cable will do; using a crossover cable is not required since all modern network cards have automatic MDI-X detection. We’ll ruin network connection on the PXE server in the process, so please make sure you don’t run anything critical.

Shut down Network Manager and manually assign an IP address to the Ethernet interface:

# systemctl stop NetworkManager
# ifconfig eth0 up
# ifconfig eth0 10.0.0.1 netmask 255.255.255.0

Save the following contents to /etc/dhcp/dhcpd.conf:

allow booting;
allow bootp;
next-server 10.0.0.1;
filename "pxelinux.0";

subnet 10.0.0.0 netmask 255.255.255.0 {
  option domain-name "pxe.local";
  option routers 10.0.0.1;
  range 10.0.0.110 10.0.0.120;
}

Restart the DHCP server so that it picks up the new configuration:

# systemctl restart isc-dhcp-server

At this point, the PXE client should be able to boot the installation image. After the installation has started, the network cable can be disconnected and the PXE client can be connected back into the regular network so that the installer could properly configure the network and download the required packages.