Ubuntu Server – How to Preseed Ubuntu Server for Automated Installation

automationinstallationserver

I am in the process of creating an automated install disc for Ubuntu Server 10.10. Is it possible to setup package selection within the preseed file (what groups of packages to install etc.)? If so how can this be done.

Best Answer

At a high level, the key part of creating is a preseed file that can specify options that the installer asks you. An example preseed file can be found at the debian website. The example provides most of the options that you may want to modify.

When it gets down to implementation, there are a few more steps to be followed:

  • Obtain the image. You can choose between a full image and a mini iso which downloads a fresh copy of packages off the internet. The process is slightly different, but mostly analogous.

  • Once you have the image, you need to extract files from the iso. There might be a one-step way to do this, but this is how I've always done it like this:

    sudo mount -o loop -t iso9660 mini.iso /mnt
    cp -rf /mnt /path/to/extractdir
    sudo umount /mnt
    
  • Now you create the preseed file that you want to use. In the mini iso, since you don't really have a hierarchy, just put it in the root folder. In the regular server install, put it in the preseed folder. It is your choice where you want to put it/what you want to call it.

  • Once you have the preseed, you need to specify it to the kernel. In the mini iso, you need to edit text.cfg, or in the full install, isolinux/text.cfg to include your preseed by editing the APPEND line as follows:

    APPEND arg1 arg2=value2 arg3 ... file=/cdrom/path/to/preseed/file locale=en_US console-setup/ask_detect=false console-setup/layout=us --
    

Don't remove existing values unless you know what you're doing

  • Once you're done modifying the preseed and text.cfg files, you need to repack things as an ISO. To do this, you need to put isolinux on the CD to make it bootable. Now, cd to the root directory of the extracted image, and do the following [taken from the syslinux website:

    cd /path/to/extractdir
    mkisofs -o output.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -T .
    

You need to add the -l (or -iso-level 2)flag to support longer file names.

Your iso is at output.iso and ready to be burned!