Even easier netboot installation…

A while ago I covered netbooting/installation on ubuntu, well I’ve now found an even easier way to do this! It’s probably the easiest way to go about this as it really only involves editing one config file. Some of the info here comes from the official Ubuntu documentation on this, though my approach is actually easier, since you don’t need a separate tftp server.

The main piece of software you will need is dnsmasq, which you can install with the command:

sudo apt-get install dnsmasq

I already had this installed as I’m using it as a DNS cache for my network (which is also pretty useful). It turns out that dnsmasq is a bit of a ‘swiss army knife’, it can do DHCP, DNS and TFTP all together and very easily. You should edit the config file:

sudo nano /etc/dnsmasq.conf

And add/uncomment/edit the following lines:

dhcp-range=,,12h # sets the ip address range and update frequency for the network
dhcp-boot=pxelinux.0 # set up network booting to boot the pxelinux bootloader
enable-tftp # enable built in tftp server
tftp-root=/var/tftpd # set tftp directory

Basically this sets up dnsmasq to be both the DHCP server for the network and push the PXE boot options out over the network. It also enables the built in TFTP server in dnsmasq and sets the directory to serve files from.

The next step is to get some files to serve, I got the PXE/netboot image from the Ubuntu cdimages site, and untarred the files to the correct directory:

wget http://archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-i386/current/images/netboot/netboot.tar.gz
sudo mkdir -p /var/tftp
tar -xvzf netboot.tar.gz -C /var/tftp/
chown -R nobody:nogroup /var/tftp

The tar file of course is basically just the minimal install CD, set up for netbooting, so when you install you will need to download all the packages, for a simple cli install this doesn’t take very long, and you can use a package cache or something to help with future installs.

OK, now restart dnsmasq:

sudo /etc/init.d/dnsmasq restart

…and you should be good to go (make sure that your machine is the only DHCP server on the network). For tips on booting clients see my original article – btw, since I used the new version of Ubuntu I can now boot my Eee PC 901 over the network!

If you have any questions or problems with this I’d be happy to answer them, just post them below.

Bye for now!

7 thoughts on “Even easier netboot installation…

  1. bob says:

    Was wondering if there is a livecd that has everything for this already installed. And if there is a way to get a live iso served over the network via pxe.
    My purpose:
    I have no spare usb drives nor a usb cd rom but would like to install crunchbang linux on my netbook and was wondering if I could do it with network boot.
    Run a live cd on my desktop then mount the drive and point to the iso or whatever files needed, then boot the netbook from the network and install via the booted live version. Is this possible?
    Also what does xjxy mean?

  2. groky says:

    Thanks Rob, this is helping quiet a bit following instructions. I tried using Ubuntu 8.10 in virtual box on a windows 7 machine to install Ubuntu 9 on a Portage 200.
    Got it to boot to the Ubuntu screen, all the way up to Installing from a mirror. Get a Bad archive mirror message. The vitual box is connected to the Internet, have tried a few mirrors, same message.


  3. Mayank says:

    Thanks a lot dude
    It helped a lot,
    But how can the process be made generic, can i extract any iso in the tftp folder and the system will boot?

Leave a Reply

Your email address will not be published.