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!
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.
You should have a look at the FAI (Fully Automatic Installtion) project.
It also does PXE network boot and a automatic installation.
http://fai-project.org
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
Hi Vidar!
I used -v just for verbose mode – /srv/tftpboot already existed on my install so I didn’t need to use -p. I’ll update the post though to include it! I’ll add Sombunall’s updates too.
Cheers!
[…] was following this guide on setting up a PXE boot infrastructure but I’m stuck now, since I cannot install DHCP on the PXE server (won’t it conflict […]
[…] PXE booting Debian Squeeze 64-bit. I followed the instructions in these following documents: – http://andys.org.uk/bits/2010/03/22/…ueeze-install/ – http://www.debian-administration.org/articles/478 3.1) I downloaded "netboot.tar.gz" […]
On
“service dhcp3-server restart”
error:
“dhcp3-server: unrecognized service”
dhcp3-server is installed. Dont now what todo????
Hi Dieter,
Apologies for taking so long to reply…
Looks like Debian have changed the DHCP server they use, so try replacing ‘dhcp3-server’ with ‘isc-dhcp-server’.
Andy.