Paul C. Williams

Interfacing Technology & Business
View Paul Williams's profile on LinkedIn

Thursday, December 12, 2013

Installing Ubuntu using network boot (PXE / TFTP)

I feel like such a stud!  Using a windows TFTP server, I loaded and installed Ubuntu 12.04 LTS Server on a 1U HP Proliant server using absolutely no media.  This was not super easy, because the TFTP server doesn't like relative paths, so I had to be tenacious to overcome the limitations.

My reward: a fully operational battle station Ubuntu Linux Server.

I have been tasked with helping my son's school make use of a server someone donated.  It has a copy of Windows Server 2008, but nobody knew the password.

Challenge Accepted

Nobody was really married to the idea of a windows server, so after failing to guess the password 3 or 4 times (my son's suggestion: "fluffy pink unicorns"), I decided to just install a new base OS.

The problem here: this particular HP server has no CD ROM drive.  No problem: I'll just grab a USB key and install from USB.  Unfortunately, my USB key must have had some bad sectors, because I couldn't get the installer to load without a corrupted file or two.

Plan B: TFTP / PXE Boot from Network

Back in the 90s, I used to help at a company that used network installation to image machines using Norton Ghost.  From this experience, I knew I could run a network install.  But, could I do it using my Windows laptop serving from a WiFi network?  I wasn't sure.

It turns out that it is, but it ain't easy.  Here are the steps:

Step 1: Check your network settings

You'll want to check your local DHCP settings to make sure there is an open range of about 3-5 addresses.  The TFTP server sends its boot configuration information out via DHCP, so you'll need to run a DHCP service as well. Fortunately, the TFTP server I found has that built in, and it does not seem to cause too many problems to have the DHCP on the router running at the same time as the DHCP in the TFTP service.

Step 2: Download the TFTP server and netboot files

Unzip the TFTP server anywhere (I chose .../Desktop/netboot).  Create a directory under netboot called root.  This will be where your PXE boot files go.  Unzip the files from the netboot tarball into the root directory.  Your root directory should look like this:

You will notice that the files that were created are all of size 1k.  These are not the correct files.  They were created as symlinks, but this is a feature that is lacking in Windows, so you have to dig around in the ubuntu-installer directory to locate the "real files" and copy them into the root folder.  At the same time, you'll need to copy in the linux loader and root images, linux and initrd.gz.


Once you've copied these files directly to the root, your directory will look like this:

These file sizes are much more believable!

Step 3: Configure the TFTP server

Now, run the TFTP server and there's some configuration to be done.

The first thing to do is to set the root directory to the directory you just prepared. That's done in the initial screen:

Next, press the "Settings" button, and get set on the TFTP tab.  I believe the most important part is the "PXE" compatibility checkbox, but I also changed the "Base Directory" to match the root we prepared.

Finally, the DHCP tab must be set. The software will complain if you leave without setting this up completely.  The hardest part is to get the network configurations to match your home network.  The IP pool start address must exist on your local network, and should not be allocated by your local router.  The boot file is the pxelinux.0 file we found earlier.

Saving this, the software will want you to restart the TFTP server.  Do so.

Step 4: Do a PXE boot on your target machine

Finally, we're ready for action.  Using the bios boot configuration, do a PXE boot.  In time, the target machine will locate the DHCP server you just configured, and attempt to use TFTP to load the pxelinux.0 file.

If you are unlucky, your PXE boot firmware might get confused by two DHCP servers. If that happens, just disable the one on your local router for now.

After the boot loader is downloaded and installed, you might notice there's an error that says something like unable to load pxelinux.cfg/default.  Ignore this.  Normally this would give you a pretty little GUI.  Unfortunately, the TFTP server doesn't seem to like relative paths (no starting '/' here), so tried as I might I couldn't get the menu system to load.  No fear -- we're doing network boot, and we're not afraid of the command line.

Fortunately, there's a little command line right below the error message


Step 5: Run the installer

This might look familiar to some folks who have been around linux a long time.  It has been so long for me that it took a couple of hours research to discover the correct parameters to launch both the bootstrapper and the kernel.  The benefit of my research follows:

boot: /linux kernel=/initrd.gz

That's it.  After hitting enter, the loader downloads from the TFTP server, the installer starts up, and all the packages are downloaded off the main mirror sites.  What you're left with is a perfectly healthy Ubuntu system to enjoy.

Any tweaks?  Let me know!


  1. forget about relative paths, command lines,
    plus you can use your distro ISO as source for a local repository then you can install w/o Internet
    plus you do not need to turn off your working DHCP
    just read this guy here:

  2. Thanks for the note. Had I found this before I did my own work, it would have been helpful. Your suggestion is definately better for production use. Mine worked well for me, because all the packages were downloaded as current version from the repository, and once operational was quite functional.

  3. the link is for installing the "live" version of Ubuntu but a similar approach is able to install let say the "Server" version; on this case you can choose to http load the packages from a local repository or from an Ubuntu repository.