Ubuntu Server – Unattended Installation (Custom CD)


I’ve lost count of the number of times that I have installed Ubuntu Server on my VMware vSphere box – so I finally looked in to performing an unattended install.

I could have setup DHCP and TFTP servers and done PXE boot from images over the network – but I wanted to work on something quicker than that (and I don’t have that much spare RAM on my vSphere box as it is).

So I settled on re-mastering an Ubuntu Server .iso image. The result is an unattended install, except for the initial boot screen (where I need to select a minimal virtual machine installation anyway).

The following steps were performed on Ubuntu Desktop.

Download Ubuntu Server – I am using the 32 bit version of Ubuntu 12.04.

Open a Terminal and create a directory to mount the Ubuntu Server iso to.

sudo mkdir -p /mnt/iso

The -p switch is very useful as it allows you to create a directory structure which does not already exist (as opposed to creating a single directory).

Change directory to Downloads:

cd Downloads

I renamed my download UbuntuServer.iso.

Mount UbuntuServer.iso to /mnt/iso:

sudo mount -o loop UbuntuServer.iso /mnt/iso

Create a directory and copy the mounted Ubuntu Server files:

sudo mkdir -p /opt/serveriso
sudo cp -rT /mnt/iso /opt/serveriso

The -r switch copies directories recursively and -T specifies no (singular) target directory.

Now we have a copy of our Ubuntu .iso to work on in /opt/serveriso – but we need to make these files writable:

sudo chmod -R 777 /opt/serveriso/

With this preparation done we can start customizing things.

If we look at the isolinux/langlist file we see all the supported languages listed that Ubuntu supports (in an abbreviated format):

bg ...

I am only interested in an English install so I am going to overwrite the contents of isolinux/langlist with the single abbreviation for English, which is “en”.

cd /opt/serveriso
echo en >isolinux/langlist

This stops the language selection menu from appearing during installation.

The next step of the process is to create a kickstart file – this will provide the server install with the answers to the various questions asked during installation, such as timezone, username, password, partition structure and so on.

Install Kickstart Configurator:

sudo apt-get install system-config-kickstart

Click the Dash button and type kickstart and then click on the kickstart application.


Obviously you should customize your settings as you see fit – I have provided mine for reference.

Basic Configuration
Basic Configuration: Set Timezone
Installation Method
Installation Method: Choose the CD-ROM installation method

Boot Loader Options

Partition Options: Add an ext4 partition to the root file system that fills all unused space on the disk
Partition Options: Add an ext4 partition to the root file system that fills all unused space on the disk
Partition Options: Add a swap file system that uses the recommended swap size
Partition Options: Add a swap file system that uses the recommended swap size
Network Configuration: Add network device eth0 and set to DHCP
Network Configuration: Add network device eth0 and set to DHCP
User Configuration: Provide username and password
User Configuration: Provide username and password

Click File, Save File and save the kickstart file ks.cfg to /opt/serveriso.

While using the Kickstart Configurator you may have noticed that the Package Selection screen did not work. Fortunately we can manually edit the ks.cfg file so that the packages that we want are installed during Ubuntu Server installation.

At the end of ks.cfg add %packages and then list the packages that you want installed. I chose to install nano, openssh-server and open-vm-tools:

open-vm-tools --no-install-recommends

–no-install-recommends installs open-vm-tools in headless mode.

Now we need to configure the CD boot command line to use the kickstart ks.cfg file.

Browse to and open /opt/serveriso/isolinux/txt.cfg.

We need to edit the append line of the default install section at the top of the file.

default install

At the end of the append line add ks=cdrom:/ks.cfg. You can remove quiet — and vga=788.

My append line is as follows:

append  file=/cdrom/preseed/ubuntuserver.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg

The final step is to create a new Ubuntu Server .iso using this command:

sudo mkisofs -D -r -V "ATTENDLESS_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /opt/autoinstall.iso /opt/serveriso

The finished .iso is /opt/autoinstall.iso.

Test your .iso in a virtual machine to make sure that everything works as it should.

The minimal interaction that I need to set my Ubuntu Server install going is documented below:

1. Press the Enter key to confirm the English language selection
Press the Enter key to confirm the English language selection
Press F4, select Install a minimal virtual machine, and then press Enter
Press F4, select Install a minimal virtual machine, and then press Enter
Press Enter to install Ubuntu Server
Press Enter to install Ubuntu Server

From here installation continues without any further input being required.

Sources: http://askubuntu.com/questions/122505/how-do-i-create-completely-unattended-install-for-ubuntu

15 thoughts on “Ubuntu Server – Unattended Installation (Custom CD)

  1. Hi Michael,

    This is a really great tutorial, much clearer than a lot of the other instruction on the web.

    I wondered whether you’d been able to get something similar working for a desktop build?

    Right now I’m getting stuck because of what I believe to be a difference in the kernel on the desktop build, resulting in the regular splash screen being displayed on install and no auto-build.

    Any help would be amazing.



    1. There is no real difference between Ubuntu desktop and server aside from the GUI.

      Just add “ubuntu-desktop” under the %packages in the kickstart and it will download them for you if it is connected to the internet or a FTP repository.

      If it’s an offline install from a CD or USB then you need to have the desktop files (gnome, unity etc.) in your install pool (g for gnome, u for unity etc.)

  2. Hi Mike,

    Great tutorial here. I’m having a bit of a problem with it though. I’m able to create ISOs that work just fine on a virtual machine, but when I try to put the same ISO onto a USB stick they don’t appear to be bootable.

    Any ideas about what the issue could be?


      1. Thanks that was really useful! (I was trying to use dd before)

        Out of curiosity, do you have any suggestions about how it might be possible to create an iso that can be bit-by-bit copied straight to disk? For example, if one were wanting to make the iso available to others who were not running Ubuntu. I’m not entirely clear what it is that Startup Disk Creator is doing.

  3. Hello, I have also encountered the issue that the custom iso will not boot off of a USB flash drive, but it does boot on a VM for isntance. The issue is on the iso, since usb is fine andI can boot other isos normally on my laptop but this one. I think (not sure at all) it might be missing some directives of eif/uefi? do you have any experiences with this?

    1. I didn’t have any issues when I wrote the article, but that is some time ago now and some things might have changed in Ubuntu?

  4. This is a good tutorial but you have a typo in the append line in the txt.cfg file.

    It reads append file=/cdrom/preseed/ubuntuserver.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg

    Should read append file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg

    Note the hyphen “-” in the ubuntu-server.seed file path.

    Also Ubuntu now uses genisoimage

  5. Hi,

    Thanks for a detailed tutorial on the unattended install of ubuntu.

    Can you please help me in disabling the auto network configuration during the install. The install prompts for DHCP configuration details.


    1. Hi Vinay,

      You have networking options during the setup of your unattended image – if you want a DHCP issued IP you should not be prompted during installation. I would make sure that your image setup is correct.

      1. Hi Mike,

        When my virtual machine is configured with virtual switch it does not prompt for the DHCP configuration details.
        On most of my machine i will not have Virtual network configured. In this case it prompts for a DHCP configuration details. I want to avoid this prompt during the installations.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s