4.6. Automatic Installation

For installing on multiple computers it's possible to do fully automatic installations using the Ubuntu Installer itself.

4.6.1. Automatic Installation Using the Ubuntu Installer

The Ubuntu Installer supports automating installs via preconfiguration files. A preconfiguration file can be loaded from the network or from removable media, and used to fill in answers to questions asked during the installation process.

Full documentation on preseeding including a working example that you can edit is in Appendix B, Automating the installation using preseeding.

4.6.2. Automatic Installation Using Kickstart

The Ubuntu installer supports automating installs using Kickstart files, as designed by Red Hat for use in their Anaconda installer. This method is not as flexible as the preconfiguration file method above, but it requires less knowledge of how the installer works.

This section documents only the basics, and differences between Anaconda and the Ubuntu installer. Refer to the Red Hat documentation for detailed instructions.

To generate a Kickstart file, install the system-config-kickstart package and run system-config-kickstart. This offers you a graphical user interface to the various options available.

Once you have a Kickstart file, you can edit it if necessary, and place it on a web, FTP, or NFS server, or copy it onto the installer's boot media. Wherever you place the file, you need to pass a parameter to the installer at boot time to tell it to use the file.

To make the installer use a Kickstart file downloaded from a web or FTP server, add ks=http://url/to/ks.cfg or ks=ftp://url/to/ks.cfg respectively to the kernel boot parameters. This requires the installer to be able to set up the network via DHCP on the first connected interface without asking any questions; you may also need to add ksdevice=eth1 or similar if the installer fails to determine the correct interface automatically.

Similarly, to make the installer use a Kickstart file on an NFS server, add ks=nfs:server:/path/to/ks.cfg to the kernel boot parameters. The method supported by Anaconda of adding a plain "ks" boot parameter to work out the location of the Kickstart file from a DHCP response is not yet supported by the Ubuntu installer.

To place a Kickstart file on a CD, you would need to remaster the ISO image to include your Kickstart file, and add ks=cdrom:/path/to/ks.cfg to the kernel boot parameters. See the manual page for mkisofs for details. Alternatively, put the Kickstart file on a floppy, and add ks=floppy:/path/to/ks.cfg to the kernel boot parameters. Additions

The Ubuntu installer supports a few extensions to Kickstart that were needed to support automatic installations of Ubuntu:

  • The rootpw command now takes the --disabled option to disable the root password. If this is used, the initial user will be given root privileges via sudo.

  • A new user command has been added to control the creation of the initial user:

    user joe --fullname "Joe User" --password iamjoe

    The --disabled option prevents any non-root users from being created. The --fullname option specifies the user's full name, as opposed to the Unix username. The --password option supplies the user's password, by default in the clear (in which case make sure your Kickstart file is kept confidential!); the --iscrypted option may be used to state that the password is already MD5-hashed.

  • A new preseed command has been added to provide a convenient way to preseed additional items in the debconf database that are not directly accessible using the ordinary Kickstart syntax:

    preseed --owner gdm shared/default-x-display-manager select gdm

    Note that if the value contains any special characters, then the value must be quoted, as follows:

    preseed preseed/late_command string "sed -i 's/foo/bar/g' /target/etc/hosts"

    The --owner option sets the name of the package that owns the question; if omitted, it defaults to d-i, which is generally appropriate for items affecting the first stage of the installer. The three mandatory arguments are the question name, question type, and answer, in that order, just as would be supplied as input to the debconf-set-selections command.

  • As of Ubuntu 6.10, the keyboard option takes X layout names. To use an X keyboard variant, set this option to layout_variant, with appropriate values of layout and variant. For example, in_guj selects the Gujarati variant of the Indian layout.

  • You may use the apt-install command to install packages in %post --nochroot scripts (although you might also choose to generate a %packages section in a %pre script and include it using %include). Note that this does not work if the post-installation script is run in the chroot environment. Missing features

As yet, the Ubuntu installer only supports a subset of Kickstart's features. The following is a brief summary of features that are known to be missing:

  • LDAP, Kerberos 5, Hesiod, and Samba authentication.

  • The auth --enablecache command to enable nscd.

  • The bootloader --linear, --nolinear, and --lba32 options for detailed LILO configuration.

  • Upgrades. To upgrade from one Ubuntu release to another, use the facilities provided by apt and its frontends.

  • Partitioning of multiple drives. Due to current limitations in the partition manager, it is only possible to partition a single drive.

  • Using the device command to install extra kernel modules.

  • Driver disks.

  • Firewall configuration.

  • Installation from an archive on a local hard disk or from an NFS archive.

  • The lilocheck command to check for an existing LILO installation.

  • The logvol --percent, --bytes-per-inode, and --fsoptions options for certain kinds of detailed Logical Volume Management (LVM) configuration. (LVM configuration in general is experimentally supported as of Ubuntu 9.04; please let us know about your experiences with it.)

  • Restrictions of a partition to a particular disk or device, and specifications of the starting or ending cylinder for a partition.

  • Checking a partition for bad sectors.

  • RAID configuration.

  • The xconfig --monitor option to use a specified monitor name.

  • Most package groups. As special cases, the "Ubuntu Desktop" and "Kubuntu Desktop" groups install the standard Ubuntu or Kubuntu desktop systems respectively, and any group name not containing a space (for example, "ubuntu-desktop") causes packages with the corresponding Task: header in the Packages file to be installed.

  • Exclusions in %packages sections are no longer supported as of Ubuntu 6.10, as a casualty of other improvements. You may need to use a %post script instead to remove unnecessary packages.

  • Pre-installation scripts and non-chrooted post-installation scripts may only be shell scripts; other interpreters are not available at this point in the installation. Example

Here is an example Kickstart file that can be used as a starting point:

#Generic Kickstart template for Ubuntu
#Platform: x86 and x86-64

#System language
lang en_US

#Language modules to install
langsupport en_US

#System keyboard
keyboard us

#System mouse

#System timezone
timezone America/New_York

#Root password
rootpw --disabled

#Initial user (user with sudo capabilities) 
user ubuntu --fullname "Ubuntu User" --password root4me2

#Reboot after installation

#Use text mode install

#Install OS instead of upgrade

#Installation media
#nfs --server=server.com --dir=/path/to/ubuntu/

#System bootloader configuration
bootloader --location=mbr 

#Clear the Master Boot Record
zerombr yes

#Partition clearing information
clearpart --all --initlabel 

#Basic disk partition
part / --fstype ext4 --size 1 --grow --asprimary 
part swap --size 1024 
part /boot --fstype ext4 --size 256 --asprimary 

#Advanced partition
#part /boot --fstype=ext4 --size=500 --asprimary
#part pv.aQcByA-UM0N-siuB-Y96L-rmd3-n6vz-NMo8Vr --grow --size=1
#volgroup vg_mygroup --pesize=4096 pv.aQcByA-UM0N-siuB-Y96L-rmd3-n6vz-NMo8Vr
#logvol / --fstype=ext4 --name=lv_root --vgname=vg_mygroup --grow --size=10240 --maxsize=20480
#logvol swap --name=lv_swap --vgname=vg_mygroup --grow --size=1024 --maxsize=8192

#System authorization infomation
auth  --useshadow  --enablemd5 

#Network information
network --bootproto=dhcp --device=eth0

#Firewall configuration
firewall --disabled --trust=eth0 --ssh 

#Do not configure the X Window System