Setting Up A PXE Install Server On Ubuntu 9.10 - Page 3

5. Installing Necessary Packages

We are going to install the packages required for the PXE server:

  • tftpd-hpa - this is the file transfer server
  • dhcp3-server - linux dhcp server, not needed if you allready have a dhcp server
  • openbsd-inetd - new inetd server
sudo apt-get install  tftpd-hpa dhcp3-server openbsd-inetd 


6. Setting Up Tftp Server

Edit /etc/inet.conf to and ensure the line is correct, last part is important:

sudo gedit /etc/inetd.conf
tftp           dgram   udp     wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /tftpboot

Ensure that it reads /tftpboot rather than /var/lib/tftpboot.

We need to check that the tftpd server is running.

netstat -lu

Check for this line:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
udp        0          0             *:tftp                                *:*    

If you don't see the tftp line, then go back and edit /etc/inet.conf again.

Then enable inetd at boot:

sudo update-inetd --enable BOOT

Now restart your inetd server:

sudo /etc/init.d/openbsd-inetd restart

Next we need to edit the /etc/default/tftpd-hpa file to change the boot directory:

sudo gedit /etc/default/tftpd-hpa

Change the file to look like this:

OPTIONS="-l -s /tftpboot"

Restart tftpd server:

sudo /etc/init.d/tftpd-hpa restart

We now need to create a folder to store our boot stuff in.

sudo mkdir /tftpboot

Now we need to change the user to nobody:

sudo chown nobody /tftpboot

Then we need to let everyone read and write to /tftpboot:

sudo chmod 777 /tftpboot

Now check if that worked:

ls -ld /tftpboot

You should see a line similar to this:

drwxrwxrwx 2 nobody root 4096 2010-01-28 15:04 /tftpboot


7. Setting Up DHCP Server

On what network interfaces should the DHCP server (dhcpd) serve DHCP requests? Answer this question by editing the line in /etc/default/dhcp3-server file. Separate multiple interfaces with spaces, e.g. "eth0 eth1". As I only want the DHCP server running on eth1, I need to change this line.

sudo gedit /etc/default/dhcp3-server

Change the INTERFACES line to:


Now we need to back up the configuration files for dhcpd server:

sudo cp /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf_orig

Now we can configure dhcpd:

sudo gedit /etc/dhcp3/dhcpd.conf

Here is my file, you will need to change the values to suit.

default-lease-time 86400;
max-lease-time 604800;

subnet netmask {
        filename "pxelinux.0";
        option subnet-mask;
        option broadcast-address;
        option routers;

This will dynamically assign IP addresses from the range to to your client computers. The gateway is

It is important that you have the line filename "pxelinux.0"; in your configuration!

Then restart your DHCP server:

sudo /etc/init.d/dhcp3-server restart

If you already have a DHCP server in your network, you must modify its configuration. Let's assume you have something like

subnet netmask {
        option subnet-mask;
        option broadcast-address;
        option routers;

in the configuration. You must add

filename "pxelinux.0";

to it (where is the IP address of our Ubuntu PXE server) so that it looks like this:

subnet netmask {
        option subnet-mask;
        option broadcast-address;
        option routers;
        filename "pxelinux.0";

Now verify that it DHCP is running (if not, you may have a problem with you dhcp config file).

ps ax | grep dhcpd    


8. Setting Up Boot Files

We now need to get the netboot files.

cd /tftpboot

Download files with lftp:

lftp -c "open; mirror" 

Instead, if Ubuntu is in your cdrom drive:

mount /media/cdrom
cp -a /media/cdrom/install/netboot/* /tftpboot/

Now we can add a splash screen to our configuration, first we need the versamenu.c32 file.

cp /tftpboot/ubuntu-installer/i386/boot-screens/vesamenu.c32 /tftpboot

Second we need a splash image;

Here is one I created for HowtoForge, download.

lftp -c "get;"

We then need to edit /tftpboot/pxelinux.cfg/default to include our boot options and splash screen, the file is pretty self-explanatory.

sudo gedit /tftpboot/pxelinux.cfg/default
default vesamenu.c32
Menu Background howtoforge_pxe.png
Menu Title Boot Menu

label install
   menu label ^Install
   menu default
   kernel ubuntu-installer/i386/linux
   append vga=normal initrd=ubuntu-installer/i386/initrd.gz -- quiet

label expert
   menu label ^Expert install
   kernel ubuntu-installer/i386/linux
   append priority=low vga=normal initrd=ubuntu-installer/i386/initrd.gz --

label cli-expert
   menu label Command-^line expert install
   kernel ubuntu-installer/i386/linux
   append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false priority=low vga=normal initrd=ubuntu-installer/i386/initrd.gz --

label rescue
   menu label ^Rescue mode
   kernel ubuntu-installer/i386/linux
   append vga=normal initrd=ubuntu-installer/i386/initrd.gz rescue/enable=true -- quiet

label Local_drive
   localboot 0
   menu label ^Local Drive

prompt 0
timeout 0

Your /tftpboot directory should look like this:



9. Booting The Client

(Please make sure that the computers that you don't want to reinstall have the network boot option disabled in their BIOS settings because otherwise it is possible that you or someone else accidentally installs Ubuntu over the existing operating system!)

Now you can boot up your first client computer. Make sure you specified in its BIOS settings that it should use the network as its first boot device. If everything goes well, you should see the splash screen, and you can choose from one of the installation options from the /tftpboot/pxelinux.cfg/default file.

Don't forget to change the order of the boot devices after the successful installation (e.g. disable booting over the network and make the HDD the first boot device) because otherwise you will start another installation!

Share this page:

Suggested articles

11 Comment(s)

Add comment


By: Miha

Excellent guide!

Had to add DNS server to dhcpd.conf:

option domain-name-servers;


By: lipilee

excellent tutorial, and thanks for the dns option hint too :)

By: dbsuk

This tutorial is spot on!

I had the same issue as Miha and had to add DNS servers to the DHCP config.

Apart from that absolutely flawless, I already had one Ubuntu Server installed so I used that for the PXE server.

The PXE install on my Dell PowerEdge sc1425 (with no CD drive) went perfectly.

Thanks very much for this.



Hi guys. Excellent tutorial.

But i have the problem.

The DHCP work when start the TFTP.....  PXE-E32 Open TFTP time out.

Can you help me Please.

My version of Ubuntu is 10.04 LTS.

I don't understand wher is the problem.



By: Meblin

I had the same problem.

If I ctrl+alt+delete on error and start boot from lan again it would work.

I then looked in

sudo gedit /etc/dhcp3/dhcpd.conf

and commented out the lines about

option domain-name=""
option domain-nam-servers

This has fixed this problem for me. Hope it helps?


By: Anonymous

Good tutorial. I like to emphasize the reader that.

He cant use Destop installer cd to get  needed netboot files . It is included with alternate installation cd.

enjoy it

By: furex

this is a really good doc!! thanks a lot.

By: ActionParsnip

Setting root pasword is not advised or supported in the ubuntu community, nor is it required

By: csg

Why are you setting tftp-server as DAEMON=yes and adding the service in inetd?

Shouldn't be DAEMON=no as inetd starts tftp-server.

 Nice article!

By: Shylenol

Is their a tutorial on how to do this using ubuntu as the server, but with windows xp as the boot image?

By: Anonymous

I think you have a typo in the section for "dhcpd.conf" where you state "You must add" to the file.



subnet netmask {
        option subnet-mask;
        option broadcast-address;
        option routers;
        filename "pxelinux.0";



subnet netmask {
        option subnet-mask;
        option broadcast-address;
        option routers;
        filename "pxelinux.0";