Unattended Ubuntu installations made easy

Michael Reed shows you how to automate the Ubuntu installation procedure to make light work of mass installations…

The Kickstart method can be extended to network deployments. This saves creating multiple copies of the CD-ROM when performing mass installations. It’s also useful in the case of machines that don’t feature a bootable optical drive. For this to work, the target machines must have a BIOS that supports booting from the network, but most modern systems do.

First a word of warning: this is a more complex procedure and you’re going to have to take over the network while you’re carrying out the install.

Set up/disable DHCP
If the computers on your network are normally assigned an IP address by a router using DHCP, you will have to temporarily alter your setup. This is because a client will attempt to boot off the DHCP server, and it needs to boot from a computer rather than a router. On the machine that you intend to use as a boot server, find the Ubuntu network settings and assign a static IP address to your computer. Do this by disabling DHCP in the settings and assigning an address such as 196.168.1.x. Replace the x with a number between 1 and 200. Having made these changes, reboot to make sure that your configuration is working and that you can access the internet.

If you already have a computer (rather than a router) that provides DHCP services for your network, you will have to consult the documentation for whatever software you use and either temporarily disable it or configure it for network booting.

Set up Dnsmasq
Dnsmasq is a tool that can provide not only DNS forwarding but also DHCP address assignment and also TFTP, a lightweight protocol that can transfer the boot files over a network. Thankfully, it’s extremely easy to set up and configure. Install it and open its config file:

sudo apt-get install dnsmasq
sudo gedit /etc/dnsmasq.conf

Most of the contents of this file can be ignored for our purposes. Scroll to the bottom and add the following lines, modifying them for your setup.

tftp-root=home/YOUR USERNAME/tftpboot
dhcp-option=3, #gateway (usually the router)
dhcp-option=6, #DNS address

Now type ‘/etc/init.d/dnsmasq restart’, and if you see no errors, we are ready to proceed to the next stage.

Set up boot files
Download the Ubuntu install files from here. Please note that the netboot files are specific to the version that you wish to install on your clients. You are looking for a file called netboot.tar.gz. Once you have this, place it in your home directory, create a new directory and unpack the contents.

mkdir tftpboot
tar -xvzf netboot.tar.gz -C tftpboot/