Pages

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:-

subnet 192.168.51.0 netmask 255.255.255.0 {
       range 192.168.51.64 192.168.51.80;
       filename "pxelinux.0";
       next-server 192.168.51.1;
       option routers 192.168.51.1;
}

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:-

mkdir -pv /srv/tftpboot/pxelinux.cfg
mkdir -pv /srv/tftpboot/debian/squeeze/i386

Next, create the config for pxelinux in pxelinux.cfg/default:-

DISPLAY boot.txt

DEFAULT squeeze_i386_install

LABEL squeeze_i386_install
     kernel debian/squeeze/i386/linux
     append vga=normal initrd=debian/squeeze/i386/initrd.gz  --
LABEL squeeze_i386_linux
     kernel debian/squeeze/i386/linux
     append vga=normal initrd=debian/squeeze/i386/initrd.gz  --
LABEL squeeze_i386_expert
     kernel debian/squeeze/i386/linux
     append priority=low vga=normal initrd=debian/squeeze/i386/initrd.gz  --
LABEL squeeze_i386_rescue
     kernel debian/squeeze/i386/linux
     append vga=normal initrd=debian/squeeze/i386/initrd.gz  rescue/enable=true --
PROMPT 1
TIMEOUT 0

Then, create boot.txt in pxelinux.cfg, which is our boot menu:-

- Boot Menu -
=============

squeeze_i386_install
squeeze_i386_linux
squeeze_i386_expert
squeeze_i386_rescue

Finally, download the installer parts from the Debian FTP mirror:-

cd /srv/tftpboot/
wget http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0
cd /srv/tftpboot/debian/squeeze/i386
wget http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/linux
wget http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz

Final steps

Make sure that tftpd-hpa and dhcp3-server are running:-

service tftpd-hpa restart
service dhcp3-server restart

You should now be able to network boot machines into the Debian squeeze installer.

I’ve also put this on the Bits Wiki as a guide – feel free to have a look and add any notes you feel may be useful!

Be Sociable, Share!

8 comments to PXE booting a Debian Squeeze install

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>