PXE boot into Ubuntu installation

Based on a Virtual Machine with Virtualbox, we prepare an Ubuntu 16.04 Server as PXE server, NTP server, DHCP server.

PXE boot into Ubuntu installation

Based on a Virtual Machine with Virtualbox, we prepare an Ubuntu 16.04 Server as PXE server, NTP server, DHCP server.

Virtualbox : Ver. 5.0.26
Virtualbox-Network: in Bridge mode to
Boot from iso : http://www.ubuntu.com/download/server/thank-you?version=16.04.1&architecture=amd64
Server Specs: 1Gb Ram/ 8Gb HDD
OS: Ubuntu 16.04 64 bit
Server Name: pxe.local
Server IP:

Performed the standard installation and configured the network card and installed the opens-ssh package, proceed with the SSH connection on the Server.
The following commands are run, entering the password for the sudores privileges when prompted.

#:~$ sudo apt-get update
#:~$ sudo apt-get upgrade
#:~$ sudo apt-get install -y bind9 isc-dhcp-server open-vm-tools tftpd-hpa ntp ntpdate
#:~$ sudo ntpdate -u 0.ubuntu.pool.ntp.org

It checks the network configuration of the server with static IP.

#:~$ sudo vi /etc/network/interfaces

Which should look like this:

auto enp0s3
iface enp0s3 inet static

You configure the hosts file

#:~$ sudo echo " pxe pxe.local" >> /etc/hosts

You configure the tftpd-hpa service

#:~$ sudo su -c 'cat < /etc/default/tftpd-hpa
OPTIONS="-l -s /tftpboot"
#:~$ sudo mkdir -p /tftpboot/preseed
#:~$ sudo chmod -R 777 /tftpboot
#:~$ sudo systemctl enable tftpd-hpa
#:~$ sudo systemctl restart tftpd-hpa

You configure the DHCP server service

#:~$ sudo su -c 'cat < /etc/dhcp/dhcpd.conf
allow booting;
allow bootp;
subnet netmask {
option routers;
option subnet-mask;
option broadcast-address;
option domain-name-servers,;
option domain-name "local";
filename "pxelinux.0";
#:~$ sudo systemctl enable isc-dhcp-server
#:~$ sudo systemctl restart isc-dhcp-server

You download the NetBoot image for Ubuntu and copy the necessary files.

#:~$ wget http://archive.ubuntu.com/ubuntu/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/
netboot.tar.gz -O ubuntu-16.04-netboot.tar.gz
#:~$ mkdir ubuntu-16.04-netboot
#:~$ tar zxf ubuntu-16.04-netboot.tar.gz -C ubuntu-16.04-netboot
#:~$ sudo cp -a ubuntu-16.04-netboot/ubuntu-installer /tftpboot
#:~$ sudo cp ubuntu-16.04-netboot/ubuntu-installer/amd64/pxelinux.0 /tftpboot/
#:~$ sudo cp ubuntu-16.04-netboot/ubuntu-installer/amd64/boot-screens/ldlinux.c32 /tftpboot/
#:~$ sudo mkdir /tftpboot/boot-screens
#:~$ sudo cp ubuntu-16.04-netboot/ubuntu-installer/amd64/boot-screens/libcom32.c32 /tftpboot/boot-screens
#:~$ sudo cp ubuntu-16.04-netboot/ubuntu-installer/amd64/boot-screens/libutil.c32 /tftpboot/boot-screens
#:~$ sudo cp ubuntu-16.04-netboot/ubuntu-installer/amd64/boot-screens/vesamenu.c32 /tftpboot/boot-screens
#:~$ sudo mkdir /tftpboot/pxelinux.cfg
#:~$ cd /tftpboot/pxelinux.cfg
#:~$ sudo ln -s ../boot-screens/syslinux.cfg default

You configure the fileSyslinux.cfg

#:~$ sudo su -c "cat < /tftpboot/boot-screens/syslinux.cfg
path boot-screens
include boot-screens/menu.cfg
default boot-screens/vesamenu.c32
prompt 0
timeout 100

You configure the Boot Menu

#:~$ sudo su -c "cat < /tftpboot/boot-screens/menu.cfg
menu hshift 13
menu width 49
menu margin 8
menu tabmsg
menu title Installer boot menu
label auto-ubuntu-16.04
menu label ^Ubuntu 16.04 automated install
kernel ubuntu-installer/amd64/linux
append auto=true priority=critical vga=788 initrd=ubuntu-installer/amd64/initrd.gz preseed/
url=tftp:// preseed/interactive=false
menu begin ubuntu-16.04
menu title Ubuntu 16.04
label mainmenu
menu label ^Back..
menu exit
include ubuntu-installer/amd64/boot-screens/menu.cfg
menu end

You configure the Preseed file with an editor (nano / vim / vi)

#:~$ sudo vi /tftpboot/preseed/Ubuntu16.cfg

You copy and paste the following text, modifying

d-i debian-installer/locale string en_US
d-i debian-installer/language string en
d-i debian-installer/country string NL
d-i keyboard-configuration/xkb-keymap select us

d-i passwd/user-fullname string
d-i passwd/username string ubuntu
d-i passwd/root-password password ubuntu
d-i passwd/root-password-again password ubuntu
d-i passwd/user-password password ubuntu
d-i passwd/user-password-again password ubuntu
d-i user-setup/allow-password-weak boolean true

d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain

d-i mirror/country string manual
d-i mirror/http/hostname string http://en.archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string

d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
d-i time/zone string Europe/Amsterdam

d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select multi
d-i partman/default_filesystem string ext4
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

d-i grub-installer/grub2_instead_of_grub_legacy boolean true
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/[sv]da

d-i pkgsel/update-policy select none
d-i pkgsel/include string unity ubuntu-desktop openssh-server
d-i pkgsel/updatedb boolean true
d-i base-installer/kernel/override-image string linux-server
tasksel tasksel/first multiselect standard
d-i pkgsel/include string lsb-release openssh-server screen sysstat wget ldap-utils docker.io
popularity-contest popularity-contest/participate boolean false
d-i finish-install/reboot_in_progress note
d-i apt-setup/services-select multiselect security
d-i apt-setup/security_host string security.ubuntu.com
d-i apt-setup/security_path string /ubuntu

d-i preseed/late_command string \
in-target /bin/bash -c 'echo -e " pxe pxe.local" >> /etc/hosts'

d-i preseed/early_command string /bin/killall.sh; /bin/netcfg
d-i finish-install/reboot_in_progress note

Now you can start the virtual machines clients for automatic installation via PXE boot.