I am tired of manually configuring instances of Ubuntu for testing web applications and for setting up workstations. I'm even more frustrated by the issues caused by inconsistent configurations.

Is there a method (hopefully not too time consuming to learn and setup) that allows for automation of the setup and configuration of an Ubuntu server or workstation from an ISO. This is primarily for virtual machine instances, but it would be helpful to also create instances on hardware.

I am specifically looking for a method to automate the installation of libraries (apt-get), configure services (such as Apache and MySQL), add 3rd party software (download, extract and build), and add libraries to scripting languages (for example, Ruby Gems or CPAN packages for Perl).


I think the most common Debian/Ubuntu method is to do your base install with preseeding. Then use something like puppet for post install configuration/installation.

If you don't want to or cannot run a full puppet install another option is to write scripts to customize the system post-install and then use those. I store some of the scripts needed for setup of the systems in my SVN repository which is available via https.

When I want to use one of the scripts in the SVN on one of the machines I run it directly from the SVN server using curl.

curl --silent https://svn.example.org/linuxdev/config_samples/lenny_setup/setup-aptsources | bash

That particular script sets up apt. This is basically the contents of the script.

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
etckeeper commit 'pre-commit setup-aptsources'
curl --silent "https://svn.example.org/linuxdev/config_samples/lenny/apt/sources.list" > /etc/apt/sources.list
etckeeper commit 'post-commit setup-aptsources'
apt-get update

The real version of my script has more error checking in it to respond appropriately if something is broke. I do thing using something like etckeeper is important that way if something does break you can easily identify what changed and revert.


If you want a quick and easy way of deploying Linux, check out Ultimate Deployment Appliance. It's not hugely unique in any of its features (anyone can set up a PXE server and kickstart files), but the way it's presented and packaged is brilliant.

I recommend the v2.0 Beta. It's quite stable and much friendlier than 1.4.


take a look a debian preseed files using debconf. Don't rule out writing your own scripts to customise your installations.


Looks like Ubuntu has some compatibility with Kickstart files.


Why not just write some bash scripts? Anything you can do from the shell prompt you can do from a shell script. It's portable, easy to learn (is a valuable skill in itself), and easy to maintain.

Also, you mentioned virtual machines: if you're using VMWare, you can easily create a template for each flavor you need.


We use ubuntu-vm-builder with some predefined configuration files and a few customs scripts. (This is for libvirt/kvm.)

Here's part of an example:

sudo vmbuilder kvm ubuntu --hostname somename --arch i386 --ip \
    --gw --dns \
    --part vmbuilder.partition \
    --user peterh --name 'Peter Hansen' --pass default --tmpfs - \
    --firstboot vmbuilder.boot.sh --mirror \
    --suite intrepid --flavour virtual --addpkg acpid --libvirt qemu:///system

That prepares the VM with networking, disk partitions, initial user, apt-get source URL, and a script that executes at first bootup. The script includes this:

# Install openssh-server
apt-get update
apt-get install -qqy --force-yes openssh-server

That gets SSH up and running. From that point on we can use ssh to install additional packages and do other setup, remotely.

We've also started experimenting with libguestfs (from Python) as an interesting alternative approach to some of the post-creation setup.

Edit: I should note that the above example was actually used with "vmbuilder", which is an older version of ubuntu-vm-builder. The specifics may be a little different now, but the principles are the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.