May 102011

Hi All,

In Part 3, we will install Debian Squeeze using our new PXE server.

Quicklinks :
Part 1
Part 2

First thing we’ll need is the network boot tarball off the Debian Website.


This tarball will let you start installing Debian, but it will then install the rest of the software from the internet. Naturally this means that the computer will need an Internet connection to get the most out of this method.

After you get the tarball, you’ll need to uncompress it, and grab a couple of files out of it, namely linux and initrd.gz and put them into a subdirectory under tftpboot called debian, so you should end up with a directory like this : /tftpboot/debian which should contain the 2 files linux and initrd.gz

Now that we have the files in the right spot, we will need to create a new entry in the /tftpboot/pxelinux.cfg/default file.
So at the moment, we have this in the file.

DEFAULT menu.c32

LABEL Memtest4.10
MENU LABEL Memtest86+ 4.10
kernel boot/memtest86+

We will need to add a code block to give us the option to boot to the Debian mini installer.

LABEL DebSqueeze
MENU LABEL Debian Squeeze 6.0.1a Net Install
kernel debian/linux
append initrd=debian/initrd.gz

So the configuration file should look like this in the end :

Once that’s done, you should be able to boot from the PXE server like previously with the Memtest kernel, except it will be loading the Debian Net install files.

Once it’s loaded, you will get this screen –

Which looks exactly like it does as if the computer was booted from a CD.
You can now install Debian straight from the network without the use of a CD.

May 092011

Hi All,

In this part, I will go through the install and setup of the needed software.
This list was in Part 1 as the software needed for this :

dnsmasq 2.55
Syslinux 4.02
Memtest86+ 4.10

The first 2 packages are the ones that make the magic happen.
Dnsmasq is a DHCP and TFTP server, which will let the computers that are connected to the network get an IP address and also grab the files it needs to boot from the server.
Syslinux, or more specifically it’s derivative pxelinux will let computers on the network request a file.

Quicklinks :
Part 1
Part 3

Step 1 – Software Install

Anyway, starting from the end of part 1 – we had just installed Debian Linux.
So first thing we do ?
We need to login, preferably as root to do all the configuration stuff first but you can login as your user and then su to root as well or install sudo and use that.

Update sources

So once you’re logged in, you’re ready to install the software. If you are going to use CDs to install the software then you should be able to skip this step, but if it doesn’t work then you can still use the apt-get update command and you should get something similar to this screenshot.

If you have an internet connection, then first thing we need to do is update the sources list with the apt-get update command.

So after we’ve run the apt-get update we should see something similar to above.
That updates the software sources that you selected while you were installing the Debian.

Installing the software

Once the software sources are up to date, you can now install the software that you need with this command : apt-get install dnsmasq syslinux memtest86+
That command will install the 3 packages and any other dependencies that they need to function.
When you run the command you should get something similar to this (I forgot to install memtest at the time of the screenshot πŸ™ ) :

Hit enter and you get …

Now you have the software that you need to boot from the network installed !

Step 2 : Configuring the Software

Configuration dnsmasq

First thing I do now is stop dnsmasq and rename it’s configuration files so we can start with a blank configuration file to make it easier to read later.
To stop dnsmasq, you run this command as root : /etc/init.d/dnsmasq stop
Then to rename the config file, you use this command : mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup.

I've done it reversed in this screenshot...

Also this is a good time to unplug the pxe server from the network if it is plugged in, because when we start up dnsmasq again, it will start trying to hand out IP addresses, and if there’s 2 DHCP servers on the network, it may wreak havoc with any new computers trying to get an IP address.

Get the files you need

Next up, you will need to create a directory for the TFTP server to store it’s files.
In this guide, I have chosen to use /tftpboot for the server root.
To create the necessary directory, you run this command, again as root :
mkdir -p /tftpboot/boot.
You will now have a directory called /tftpboot and a sub-directory called /tftpboot/boot created.
You will need these later to store the files you use to network boot computers.
You will also need a /tftpboot/pxelinux.cfg directory created, this is where the configuration files for pxelinux will live.

Next is to copy the files for pxelinux over to the tftpboot directory.
You will need 2 files for this step, pxelinux.0, and menu.c32.
In Debian, the files are located in /usr/lib/syslinux which is where apt-get installed the syslinux package.
Both pxelinux.0 and menu.c32 will need to go into /tftpboot, and to achieve that you will need to run these commands which will copy the files to where we need, again as root :
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
cp /usr/lib/syslinux/menu.c32 /tftpboot

After that, we need to copy the memtest file to the correct directory.
When you first install it, it is installed into /boot for use on the local machine.
To copy it to where we need, we do another cp to where it needs to go.
cp /boot/memtest86+.bin /tftpboot/boot/memtest86+
I’ve removed the .bin extension as PXELINUX won’t boot memtest properly if the bin extension is kept.

Now with all the files in the correct spot, we can move onto the configuration files.

This is the time to setup a static IP address if you haven’t already. The configuration will differ depending on whether you have 1 or 2 network cards, but the general setup remains the same.
I have used as the IP address for my pxe server, and so my configuration file (/etc/network/interfaces) goes :

auto eth0
iface eth0 inet static

Whether your configuration will be the same or not will depend in your network, but that will work for now.

For dnsmasq, we will need to specify some options to setup the tftp server’s options.
We will need to create a new file with your favourite text editor at /etc/dnsmasq.conf.
The following lines will be added –
This option is needed if you have more than 1 network card, it will tell dnsmasq to listen on eth0 for the DHCP requests.
This will set the range of IP addresses that dnsmasq will assign out to computers. For this guide, I have set it up to only assign a range from to with a subnet mask of, but you will need to change this to suit your own network.
This enables the TFTP server in dnsmasq.
This sets the root path for the TFTP server, in this guide I have used /tftpboot but you are free to choose your own, or use the default of /var/lib/tftpboot.
This line sets the file, server name, and ip address for network boot clients to boot from.

So all together, you get :


After you save this file, you will need to start up dnsmasq again, as we stopped it earlier.
/etc/init.d/dnsmasq start will start it up, and you should get something like :

In /tftpboot/pxelinux.cfg/ we need to create a file called default.
This default file will be the file that all computers will read to get the menu options etc.
In there, we should have the following :

DEFAULT menu.c32

LABEL Memtest4.10
MENU LABEL Memtest86+ 4.10
kernel boot/memtest86+

With these 3 files setup, you should be setup to boot from the network.
I got my other virtual PC to boot from the network and I get :

In Part 3, I will add some more functions to your new pxe netboot server πŸ™‚

Some further reading:
Syslinux menu config file documenation

May 072011

Hi All,

I’ve been messing around with PXE booting for a little bit now so thought I’d throw up a guide on how to set a PXE server up from scratch, since the guides that I’ve found online seem dated.
For quick guide on how PXE works, have a look here :
an Image of how it works

This guide will be split into 3 parts,
The first part – Which is this post, will detail how to setup / install Debian.
Anyone vaguely familiar with Linux should be able to skip straight to Part 2.
Part 2 will be the setup of the server, and in Part 3, I will detail how to add extra boot options.

Quicklinks :
Part 2
Part 3

Now onto the Part 1.
In this part, I will install Debian Squeeze onto a Virtual Machine.
It’s up to you whether you use Debian or another distribution, I’ve used it as it’s the one I’m most familiar with. It’s also one that I happen to be able to install right now.
The choice of distribution isn’t really important though, as long as you can install the software needed, any distribution is as good as another for this purpose.

This is the software I will be using in this guide :
dnsmasq 2.55 – A DHCP / TFTP Server that we will be using the assign IP addresses and host the netboot files.
Syslinux 4.02 – The netboot software that is used so that computers can boot off the pxe server.
Memtest86+ 4.10 – This will be what your PXE server will be remotely booting at the end of it all.
The software isn’t the newest, but it is what comes on the Debian Squeeze (6.0.1a) CDs and is sufficient for today.

With this guide, you won’t need to know too much about Linux as I’ll be providing (hopefully) easy to follow screenshots, but if you’ve found this guide then you are probably pretty comfortable with Linux already, if not, let’s continue !

Also I have not installed a graphical interface as I have assumed that after it is setup, you won’t be needing to use this computer / server as a workstation, however you are free to install a graphical environment during the setup.

So, onto what you will need :
A computer with at least 1 network card.
A Storage device that you can install Debian on and boot from, at least 4 Gigabytes in size preferably, although you can make do with less.
An internet connection is optional.
Debian Squeeze CD
You will need the 1st CD to install the base system, then you can download the rest of the packages that you need..
For an offline install without any internet access – you will need these 5 CDs – 1, 5, 6, 7 and 8.

Step 1

Ok, so starting off, the boot screen you see when you pop in the Debian install cd :

This is where you can select what you want to do with the CD. In our case, we’ll select Install and hit enter.
Which will bring us to a screen similar to this :

This screen lets us select the language we want to use.
I’m assuming you’ll be using english so we’ll select that and hit enter to progress.
The install process is pretty simple for Debian, just a matter of following the prompts.
I had a DHCP server setup for my example server to get an IP address so I got to this screen :

Otherwise you will get this :

You can setup your own networking this way instead of setting it up later on as I do in this guide.
Setting it up earlier would be recommended for computers with only a single NIC which you are using to network boot other computers. Otherwise if you have a computer with Dual NICs and one of them is already connected to the network and can successfully get an IP address, the setup should continue without a hitch. Otherwise if both NICs are not connected then a situation similar to the single NIC situation above will apply.

The next important step is to select a network mirror or software source.

This will only work if you are actually connected to the internet. If you’re not then it will ask for CDs to be put in as software sources.
After that, you will be asked for root password and also a username and password for yourself.
Following this will be the hard drive setup, where you will choose how to partition the drive, which will then let you install the system and the components you select, as well as the GRUB bootloader.

After the install and a reboot, you should be greeted with this screen :

Congratulations, you now have a working install of a base Debian install.
And now for Part 2.

Some further reading:
Syslinux menu config file documenation