PXE booting a Debian Squeeze install

Update: I’ve not tested myself, but the comment from Sombunall below points out that package names for the TFTP server and the DHCP server have changed since I wrote this post!

It’s often the case that there’s no easy way of installing a machine that doesn’t have any removable media. For instance, I have an old Compaq Deskpro EN that’s too old to support booting from USB, so using something like UNetbootin is out of the question. Luckily, there’s an an alternative, which is to PXE boot an installer over the network.

PXE (or Preboot eXecution Environment) is a means of booting a machine over a network,which conveniently removes any requirement for anything special on the machine that’s to be installed other than an network card. PXE boot (or network boot) support tends to be available in older machines that don’t support booting from USB, so it’s a very useful feature to be able to use.

There’s a very useful article on Debian Administration that covers configuring a Debian machine to act as a PXE boot server to serve out an etch installer. I personally run squeeze, so I’ve used the article as a basis for setting up a Debian squeeze machine to serve out a squeeze installer.

Installing the prerequisites

To start with, we need a TFTP server and a DHCP server. You might already have one (or both) of these installed already, but for the purposes of this we’ll assume that you haven’t. So, to get started, install the tftpd-hpa and dhcp3-server packages:-

apt-get install tftpd-hpa dhcp3-server

Configuring DHCPd

First, make sure that the tftpboot directory exists. This used to be /var/lib/tftpboot, but Debian now uses /srv/tftpboot. The installer should have created it, but just in case, check it exists and if create it if not.

The next step is to add a subnet declaration to /etc/dhcp3/dhcpd.conf for your network. A simple one will be something like this:-

If you’ve already got DHCPd installed and configured, the two lines highlighted in green are the ones you need to add to your existing subnet declaration. The filename option tells PXE clients which file they need to request via TFTP, and the next-server option tells the clients the TFTP server they should use to get it.

Creating the PXE boot environment

Before we pull down any of the installer files, we need to create somewhere for those files to go, along with the PXE boot configuration. So, create the pxelinux.cfg and debian/squeeze/i386 directories:-

8 comments to PXE booting a Debian Squeeze install

This will work with the new stable squeeze except tftpboot is just tftp and I think dhcp3-server is isc-dhcp-server. I tried to use dd-wrt for DHCP but failed. I also saw a post on dd-wrt forum that failed to use DNS-masq for DHCP PXE. Luckily I just used my server for DHCP like the article says.

I spent hours reading about PXE earlier today, without really getting anywhere, so I drove to
where the server was and tried installing from USB pen-drives, but for some reason it just
didn’t feel like booting off of USB even though according to its BIOS it was going to..Also, I
was out of recordable CDs. But then I found this article..

I can’t thank you enough, Andy, I was pretty fed up before I followed your instructions, and
about to go home to continue some other day, but this just works!

I don’t understand why you use -v and not -p here though:
mkdir -v /srv/tftpboot/pxelinux.cfg

Also, could you update your post with Sombunall’s corrections, please? I can confirm he is
correct