Netbooting the live server installer

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:

  1. The to-be-installed machine boots, and is directed to network boot.
  2. The DHCP/bootp server tells the machine where to get pxelinux.0.
  3. The machine’s firmware downloads pxelinux.0 over tftp and executes it.
  4. pxelinux.0 downloads configuration, also over tftp, telling it
    where to download the kernel, ramdisk and kernel command line to
    use.
  5. The ramdisk reads where to download the server ISO from, downloads
    it and mounts it as a loop device.
  6. 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.

  1. Install dnsmasq with “sudo apt install dnsmasq”

  2. 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).

  1. restart dnsmasq with sudo systemctl restart dnsmasq.service.

Serving PXELINUX and its configuration

  1. Download pxelinux.0 and put it into place:

    # wget http://archive.ubuntu.com/ubuntu/dists/eoan/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/pxelinux.0
    # mkdir -p /srv/tftp
    # mv pxelinux.0 /srv/tftp/
    
  2. Download the latest live server ISO for the release you want to install:

    # wget http://cdimage.ubuntu.com/ubuntu-server/daily-live/current/focal-live-server-amd64.iso
    
  3. Mount it.

    # mount ubuntu-19.10-live-server-amd64.iso /mnt
    
  4. Copy the kernel and initrd from it to were the dnsmasq serves tftp from:

     # cp /mnt/casper/{vmlinuz,initrd} /srv/tftp/
    
  5. Create /srv/tftp/pxelinux.cfg/default containing:

    DEFAULT install
    LABEL install
      KERNEL vmlinuz
      INITRD initrd
      APPEND ip=dhcp url=http://cdimage.ubuntu.com/ubuntu-server/daily-live/current/focal-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.

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.

2 Likes