Enable PXE boot

From UpWiki
Jump to: navigation, search

In this tutorial, you will be able to create your PXE server on your UP and then, install your Ubuntu in other UP boards via Ethernet.

In this case, we will use Ubuntu 16.04 server for UP server board and the OS for UP client board.


00. Install Ubuntu 16.04 server for board server:

Check the ISO here:

  http://releases.ubuntu.com/16.04/

01. Prerequisites

sudo apt-get install apache2 tftpd-hpa inetutils-inetd isc-dhcp-serve
sudo apt-get install pxelinux syslinux dnsmasq

02. Configure DHCP server (choose any available address network):

Edit: sudo nano /etc/network/interfaces

Define your own Network:

auto enp2s0
iface enp2s0 inet static
address 192.168.1.150
netmask 255.255.255.0

Edit: sudo nano /etc/default/isc-dhcp-server Add your network interface:

INTERFACES="enp2s0"


Edit: sudo nano /etc/dhcp/dhcpd.conf

Uncomment the following line: authoritative;

Add your own subnet:

subnet 192.168.1.0 netmask 255.255.255.0 {
 range 192.168.1.9 192.168.1.30;
 option routers 192.168.1.1;
 option broadcast-address 192.168.1.255;
 default-lease-time 600;
 max-lease-time 7200;
}

Restart dhcp server:

sudo systemctl restart isc-dhcp-server


03. Configure TFTP server:

Edit:

sudo nano /etc/default/tftpd-hpa

Add:

[...]
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"

Edit: sudo nano /etc/inetd.conf

Add:

tftp    dgram   udp    wait    root    /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

Restart tftpd server:

sudo systemctl restart tftpd-hpa
sudo systemctl status tftpd-hpa


04. Download the UEFI signed grub image:

http://archive.ubuntu.com/ubuntu/dists/trusty/main/uefi/grub2-amd64/current/grubnetx64.efi.signed

Copy the file into /var/lib/tftpboot directory.


05. Download the correct netboot.tar.gz archive (navigate to the correct one!):

http://cdimage.ubuntu.com/netboot/

We recommend Ubuntu 14.04 netboot package.

Extract netboot.tar.gz into /var/lib/tftpboot


06. Create the grub configuration:

Create a grub directory:

mkdir /var/lib/tftpboot/grub/

Create and edit a configuration file for your grub:

sudo nano /var/lib/tftpboot/grub/grub.cfg

For standard install (Not Preseeded), add:

menuentry "Install Ubuntu" {
 set gfxpayload=keep
 linux /ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600 --- quiet
 initrd /ubuntu-installer/amd64/initrd.gz
}


07. Edit DHCP server settings:

sudo nano /etc/dhcp/dhcpd.conf

Add:

allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server 192.168.1.150;
filename "grubnetx64.efi.signed";</code>

Restart DHCP server:

sudo systemctl restart isc-dhcp-server


08. Setup for UP client:

Enable PXE network from BIOS settings on UP2 client:

Advanced -> Network Stack Configuration -> Enable Network Stack -> Enable Ipv4 PXE Support

Also, select the Network option as first boot option:

Boot -> Boot Option #1 : [Network:UEFI: Ipv4..]

Connect the UP server to the UP client via Ethernet cable.

Power your board on and then, PXE will boot after some seconds.

You will see the Ubuntu installer running there.