Official website for Linux User & Developer

Unattended Ubuntu installations made easy

by Michael Reed

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…

Pages: 1 2 3 4
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.
    • Markus

      Hi and thank you for this guide.

      I just have one problem. I don’t have any network/internet attached to my computers. So the unattended ubuntu installation stops while searching for dhcp.. How can I skip this step? To stop it from searching for a network.
      Thank you

      Best regards Marku

    • Thomas Lange (Mrfai)

      Have a look at the FAI project. It supports Ubuntu since several years, and has a lot of users. It’s very flexible and can do much more than preseeding or installlinux.

    • Hi,

      I have 10 system small lab i want to install fedora12 in all the system through NFS, HTTP & FTP.
      I configured nfs server one of the lab PC, but when i install through nfs in other PC it showing NFS not found.

      Can any one please help me out.

    • Pingback: SCCM 2012 SP1 Clients Uprade - 4sysops()

    • Thanks for the information, here is a shell script which is based on this article:

    • santhu ms

      iam getting this error when trying to create the iso using the above method
      I: -input-charset not specified, using utf-8 (detected in locale settings)
      genisoimage: Missing pathspec.
      Usage: genisoimage [options] -o file directory …

      Use genisoimage -help
      to get a list of valid options.

    • Lionel Sanderson

      Thanks heaps, Needed to create unattended install of Ubuntu for an assessment for diploma. I did find a script online that you just pointed the terminal towards and it asked you a few questions, downloaded the entire ISO and restructured it with your answers and created an autoboot ISO …but had issues with it. This has done the job

    • Lionel Sanderson

      there is also ‘UNETBOOTIN’ you can just download to create usb thumb drive autoboot, but this just boots ubuntu normally or you can choose to install it.. its not an unattended install :)