Netbooting the live server installer
The process for network booting the live server installer – at least
on systems that support PXE network boot – goes like this:
- The to-be-installed machine boots, and is directed to network boot.
- The DHCP/bootp server tells the machine where to get pxelinux.0.
- The machine’s firmware downloads pxelinux.0 over tftp and executes it.
- pxelinux.0 downloads configuration, also over tftp, telling it
where to download the kernel, ramdisk and kernel command line to
use. - The ramdisk looks at the kernel command line to see where to download the server ISO from, downloads it and mounts it as a loop device.
- From this point on the install follows the same path as if the ISO
was on a local block device.
Configuring DHCP/bootp and tftp
There are several implementations of the DHCP/bootp and tftp protocols
available. This document will briefly describe how to configure
dnsmasq to perform both of these roles.
-
Install dnsmasq with “sudo apt install dnsmasq”
-
Put something like this in /etc/dnsmasq.conf.d/pxe.conf:
interface=<your interface>,lo bind-interfaces dhcp-range=<your interface>,192.168.0.100,192.168.0.200 dhcp-boot=pxelinux.0 enable-tftp tftp-root=/srv/tftp
(This assumes several things about your network; read man dnsmasq
or the default /etc/dnsmasq.conf
for lots more options).
- restart dnsmasq with
sudo systemctl restart dnsmasq.service
.
Serving PXELINUX and its configuration
-
Download pxelinux.0 and put it into place:
# wget http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/current/legacy-images/netboot/pxelinux.0 # mkdir -p /srv/tftp # mv pxelinux.0 /srv/tftp/
-
Download the latest live server ISO for the release you want to install:
# wget http://releases.ubuntu.com/focal/ubuntu-20.04.1-live-server-amd64.iso
-
Mount it.
# mount ubuntu-20.04.1-live-server-amd64.iso /mnt
-
Copy the kernel and initrd from it to were the dnsmasq serves tftp from:
# cp /mnt/casper/{vmlinuz,initrd} /srv/tftp/
-
Make sure to have installed package
syslinux-common
and then:# cp /usr/lib/syslinux/modules/bios/ldlinux.c32 /srv/tftp/
-
Create
/srv/tftp/pxelinux.cfg/default
containing:DEFAULT install LABEL install KERNEL vmlinuz INITRD initrd APPEND root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=http://releases.ubuntu.com/focal/ubuntu-20.04.1-live-server-amd64.iso
As you can see, this downloads the ISO from Ubuntu’s servers. You
may well want to host it somewhere on your infrastructure and
change the url to match.For releases newer than Ubuntu 22.10 you can specify the URL with iso-url= instead of url= which can avoid multiple downloads of the ISO (as cloud-init looks for url= on the kernel command line as well).
This configuration is obviously very simple. PXELINUX has many, many
options, and you can consult its documentation at
https://wiki.syslinux.org/wiki/index.php?title=PXELINUX for more.