Fortunately, there is a solution in the form of unattended installs. An admin can alter a standard Linux distribution so that it no longer asks the user questions while installing. Obviously, the installer will need the information that it normally acquires by prompting the user for details, and the trick is to provide this information in advance in the form of what is called an ‘answer file’. It’s possible to divide automated installs into two main categories: customised CD-ROM and network installation. Both approaches have their relative strengths and weaknesses.
As with most things on Linux, there is more than one system that you can choose from, but we’re going to use something called Kickstart. Kickstart is an automatic install system that started life on Red Hat-derived Linux distributions, but it’s supported on Ubuntu. It comes with a GUI tool to create the configuration file, making it very simple to use. Let’s start with a quick breakdown of its core settings…
Configuration using the Kickstart GUI
A lot of the settings can be left in their default state, but here are some of the most important ones.
Basic Configuration: Location and language settings.
Installation Method: Switch this to ‘CD?ROM’.
Partition information: Create a minimum of a root (/) partition of ext4 format and a swap partition. You can set the root partition to fill the free space on the disk.
User configuration: Create one user account and no root account if you are comfortable with Ubuntu’s standard rootless setup.
Package selection: This isn’t implemented in Ubuntu. However, it’s possible to add packages to the configuration file manually, by adding a line with ‘%packages’ (no quotes) followed by package names, each on its own line. By default, a Kickstart-modified Ubuntu CD-ROM will install the same Ubuntu desktop and associated programs that a standard Ubuntu CD?ROM would.
Creating an unattended install consists of the following steps:
1. Create a configuration file, ks.cfg, using the GUI Kickstart tool.
2. Extract the files from the Ubuntu install ISO.
3. Add the ks.cfg file to the install disk and alter the boot menu to add automatic install as an install option.
4. Reconstitute the ISO file.
An important thing to remember with answer files is that if you forget to add something, the installation will be interrupted with a question in the usual way. This can be a problem, but on the other hand it ensures
that a Kickstart install disk isn’t rendered useless if the installer encounters an unforeseen circumstance and is forced to ask a question. It’ll probably take a couple of goes and a bit of experimentation before you create the perfect install disk, so we advise you to use a virtual machine (see our guide to VMs in issue #85) to test the disk before committing to burning a CD.
Much of Kickstart’s ease of use is thanks to its graphical configuration tool. It’s in the Ubuntu repositories, so search for it using the package manager or install it via the command line, as follows:
sudo apt-get install system-config-kickstart
Once installed, the Kickstart GUI tool should place itself in the System Tools menu of the application launcher. Launching it, you’ll be presented with about a dozen pages of options, but fortunately, all of them should be fairly self-explanatory to anyone who has installed Ubuntu before (see boxout to the right for more details).
Now save the Kickstart configuration file. By default it is called ks.cfg, but you can give it any name. It’s a good idea to check over the configuration file manually by launching it in a text editor. We now need to copy the files from the Ubuntu install CD-ROM into a directory on the hard disk. Download the alternative install ISO (rather than the live CD) from the Ubuntu website and place it in your home directory. Mount this disk from the command line:
sudo mount -o loop ubuntu-10.04-beta2-alternate-i386.iso iso_mount
This makes the files inside the ISO accessible via the directory ‘iso_mount’. Note that you can browse this directory using a file manager, but we’d recommend doing the actual file copying from the command line because hidden files and directories must be preserved. Copy the files to a directory inside your home directory and make them writable with:
rsync -a iso_mount/ ubuntu_files/
sudo chmod -R 777 ubuntu_files
Place the Kickstart file that you have created into the ‘ubuntu_files’ directory. Now we have to tell the install system where to find the Kickstart configuration file when it boots. Load ‘text.cfg’, located in the ‘isolinux’ directory, into a text editor. This file contains the menu options that you first see when you boot an Ubuntu installation disk. Locate the menu options for a standard install and then cut and paste them so that you have a second copy. We’re going to alter it so that it looks something like this:
menu label ^Automatically Install Ubuntu
append file=/cdrom/preseed/ubuntu.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg –
We’ve altered the label and title of this new menu entry, added a reference to the location of the Kickstart file and removed the ‘quiet’ flag so that we get lots of progress information. This constitutes the entirety of the changes we have to make, and we can now re-create the ISO file.
mkisofs -D -r -V “$IMAGE_NAME” -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/autoinstall.iso .
Voilà, your non-interactive install disk is now ready. Take our tip: try booting the ISO inside a virtual machine to make sure it works. Notice that it does require some interaction at the very first menu. It is possible to edit things so that it won’t prompt for even that initial confirmation, but this is dangerous as this disk will cheerfully wipe a system. It also makes a great recovery disk that a non-expert can use to zero a system. However, if used in this role, you should explain that the disk is potentially dangerous and mark it appropriately.
Incoming search terms:
- ubuntu kickstart
- ubuntu unattended install
- ubuntu unattended
- kickstart ubuntu
- ubuntu unatteded setup
- ubuntu auto install
- ubuntu kickstart howto
- ubuntu 12 04 unattended install
- unattended ubuntu install
- ubuntu unattended installation