Install Ubuntu on a PXE enabled computer (no installation media).

Configure a DHCP and TFTP server to enable a PXE client to install the Ubuntu OS without disc based installation media.

As with any installation on any computing platform, it is good practice to ensure important data is backed up in case unforeseen difficulties arise.
Review all instructions on this page before you begin.

Page dependencies (ensure you have access to everything you need before you begin).
Commands issued at the command prompt in this section are done so as superuser or root unless otherwise specified. When installed, Ubuntu does not ask for a root password to be specified. Either set a root password using sudo passwd root so that you can log in as superuser, or enter the commands listed in this guide prefixed with 'sudo'.

Text file editing from the command line.
This guide uses the Nano application for text editing because of its simplicity. Alternative text editors are available. Basic Nano key combinations to remember are CTRL-O to save and CTRL-X to exit.

Page format.
Text in this format indicates command line entry by the user.
Text in this format indicates an error returned by the system.
Text in this format indicates a normal return from the system.
Beware of similar characters such as 1(one), l(lowercase L), 0(zero), O(uppercase 'o'), | (pipe – Shift ' ' usually).
Text enclosed in [square brackets] indicates a build-specific variable such as a version number or user name.

This page was written for Ubuntu 6.06 (Dapper) and may contain content or instructions that are not relevant to other distributions.
This information is provided for guidance only. Use of these instructions is deemed to be at your own risk.
R3UK Limited welcomes comment on this information but cannot guarantee a reply and provides no technical support. Please use one of the many dedicated Linux forums or IRC channels if you require assistance.
Text colours and fonts used in the formatting of this page relating to command input and output are used for illustration purposes. Actual command line colours and fonts will vary according to individual system preferences.
GUI instructions were written for the Gnome 2.14 desktop environment and may differ for other desktop environments.

I came across an interesting predicament recently. I had to get Ubuntu onto a Toshiba R100 laptop but this model has no internal optical drive and won't boot from a USB CD-ROM (I'm glad to see the BIOS in the R200 does). All I had was a PCMCIA CD-ROM drive which has been used for booting this model in the past. Unfortunately Ubuntu doesn't like this drive and the installer falls over soon after starting. This laptop does however support PXE (network) booting.

I blew the dust off a Dell Optiplex GXa (266MHz PII) and set it up as a DHCP/TFTP server capable of starting a PXE installation. First job is to use Synaptic or apt-get to install the DHCP and TFTP daemons...

apt-get install dhcp3-server
apt-get install tftpd-hpa

Edit /etc/default/dhcp3-server and change the INTERFACES="" line to match your network interface (use ifconfig if you aren't sure which interface to use). So, if eth0 is your live network interface, the line should read: INTERFACES="eth0".

Next, edit /etc/dhcp3/dhcpd.conf. Comment out all lines. For simplicity I amended the existing section entitled "A slightly different configuration for an internal subnet", however the necessary configuration can be entered anywhere. For me, the configuration was as below. You will need to change the addresses and mask to suit your network requirements.

subnet netmask { # Adjust for your network
range; # DHCP address range to use
option domain-name-servers; # DNS Server
option routers; # Router address
default-lease-time 600;
max-lease-time 7200;
group {
next-server; # Address of TFTP server
host tftpclient {
hardware ethernet 00:08:0d:d8:73:d9; # Client MAC address
filename "pxelinux.0"; # Boot filename

The DNS and Router addresses will often be the same as each other (although not in this case). I have specified a DHCP address range of five addresses outside of the normal address pool. The client MAC address also needs to be specified.

That should be enough to enable DHCP. Next there is a quick configuration of TFTP required. Edit /etc/default/tftp-hda and change the line RUN_DAEMON to "yes" and, for logging, enable verbose operation (incoming and outgoing) by adding -v -v to the options line. My config file reads as follows...

OPTIONS="-l -s -v -v /var/lib/tftpboot"

Now both DHCP and TFTP can be started (or restarted) with their new configurations by typing the following:

/etc/init.d/dhcp3-server restart
/etc/init.d/tftp-hda restart

This is probably a good point to verify all is okay up to here by initiating a PXE boot from the client laptop and ensuring it picks up the expected DHCP address and attempts to contact the TFTP server. Of course, the TFTP part should error with a "File Not Found" as we haven't put the boot files into place yet, but any other error such as not picking up an IP address or TFTP timing out should be investigated. Use tail -f /var/log/syslog on the TFTP machine to keep an eye on what happens during the PXE boot.

Next switch to the default TFTP root directory and download the netboot files needed. Note that the 'lftp' command below is all on one line....

cd /var/lib/tftpboot
lftp -c "open http://archive.ubuntu.com/ubuntu/dists/dapper/main/installer-i386/current/images/; mirror netboot/"

If using a different flavour of Ubuntu (e.g. Edgy) then change the repository to match. Smilarly change the above if not using i386 architecture. Wait for the files to download and you should then have a netboot directory in /var/lib/tftpboot.

Use the following command CAREFULLY. If you make a typo and insert a space before the forward slash then you will be in a world of pain (take it from someone who's done it!). There is a space after the asterisk followed by a full stop...

mv netboot/* .

The contents of netboot should now be listed under /var/lib/tftpboot and as netboot is empty it can be removed if you wish with the rmdir netboot command.

Extract the netboot.tar.gz archive as follows:
tar -zxf netboot.tar.gz

Use the ls -l command to list the directory contents. There should be a symbolic link from pxelinux.0 to ubuntu-installer/i386/pxelinux.0. If this link is incorrect then delete it. If it doesn't exist then create it with:
ln -sf ubuntu-installer/i386/pxelinux.0 pxelinux.0

When done, the contents of /var/lib/tftboot should look similar to my listing below:

root@BIOHAZARD:/var/lib/tftpboot# ls -l
total 21956
-rw-r--r-- 1 root root 7269160 2006-05-31 01:52 boot.img.gz
-rw-r--r-- 1 root root 7800832 2006-05-31 01:52 mini.iso
-rw-r--r-- 1 root root 7362560 2006-05-31 01:52 netboot.tar.gz
lrwxrwxrwx 1 root root 32 2006-11-26 20:12 pxelinux.0 -> ubuntu-installer/i386/pxelinux.0
drwxr-xr-x 2 root root 4096 2006-11-26 20:04 pxelinux.cfg
drwxr-xr-x 3 root root 4096 2006-05-31 01:52 ubuntu-installer

You should be able to verify TFTP operation by attempting to pull pxelinux.0 into another directory. For example:

cd /home/[username]
tftp -v -c get pxelinux.0
(to) [enter your TFTP server IP address]

This should place a copy of pxelinux.0 into /home/[username].

That should be all there is to the configuration. PXE boot the client and it should start the Ubuntu installer. Once the setup questions have been answered (locale, default user, etc.), the client should pull the files it needs from a repository and install.

Did the information on this page help you? If so, please help to fund this site by clicking one of our sponsored ads...