Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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).

share|improve this question
up vote 2 down vote accepted

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 | 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 "" > /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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

Looks like Ubuntu has some compatibility with Kickstart files.

share|improve this answer

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.

share|improve this answer

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 --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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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