Unattended Ubuntu installations made easy

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

We need to customise the Kickstart file for netbooting, but fortunately, it only needs two small changes. Find the line that references the CD-ROM install option and change it to: url –url Now add these lines:


to the end of the file. This isn’t needed for CD‑ROM based installs due to an inconsistency in the way Kickstart works on Ubuntu.

Set up Apache
Put your IP address into your web browser to check that the Apache web server is installed and working. Presuming that you are greeted with a message that everything is working okay, create a directory in your home directory and link it to somewhere that Apache can see it.

sudo apt-get install apache
mkdir webshare
cd /var/www
ln -s home/YOUR USERNAME/webshare

Place your ks.cfg file into this directory and test that it can be seen on the network by typing http://YOUR IP ADDRESS/webshare/ks.cfg into a web browser address bar. If everything is working okay, you should see the contents of your Kickstart file.

The final change that is needed is to alter the boot menu to make sure that it will use the Kickstart file that you have altered. As with the custom CD image, the file you need to alter is called text.cfg, but this time it’s located inside the ‘~/tftpboot/ubuntu-installer/i386/boot-screens’ directory.

Performing the install and making things more efficient
Everything should now be in place for you to perform a complete network install. Try it out with a spare computer or a VM. On most systems, booting from the network can be performed by changing the boot order in the BIOS setup (usually entered by pressing Del upon startup).

Once you have a working, bootable system, you can make more efficient use of your network by applying Squid as a proxy cache. This saves fetching the packages over your internet connection for each individual install. First, install it and set it up by entering:

sudo apt-get install squid3

By default, the current version of Squid uses port 3128, so we’ll pass this to the kernel by adding http_proxy=”http://YOUR IP ADDRESS:3128” to text.cfg. Insert it just before the ks= statement that we added before. Squid itself requires a bit of configuration to work efficiently as a package cache. We need to make it accessible from our local network, increase the maximum object size to 200MB and increase the maximum cache directory size to 1GB. Search for, alter and uncomment the following lines in the Squid config file (sudo gedit /etc/squid/squid.conf) and then restart it with sudo /etc/init.d/squid restart.

acl our_networks src
http_access allow our_networks
maximum_object_size 100000 KB
cache_dir ufs /var/spool/squid 1000 16 256

Installing over the internet with Squid as a caching proxy becomes more efficient the more times that it is used. The added benefit is that it makes use of the latest versions of each package rather than the outdated packages on a CD‑ROM.

Other methods of unattended install
Instalinux is one of the simplest approaches available. The Instalinux website presents the user with a set of questions and then builds a bootable ISO disk ready for download. Handy for when you’re in a hurry.

Preseed Preseeding is an alternative way of automating an install. It’s very similar to Kickstart, and preseed commands can be used inside your ks.cfg, combining the two approaches. Preseeding is more complicated, but it’s more flexible too. One advantage that it offers is the possibility to generate a seed file containing all of the settings of a running Linux install. There is an introductory guide to preseeding on the Ubuntu website here.

Fully Automatic Installation (FAI ) is a system for performing mass unattended installs over a network. It comes complete with a GUI for configuration and real-time progress indication.

Click here to see what else was in issue 88 of Linux User & Developer magazine…