Automatic Installs of Turnkey Linux Appliances on Virtual Private Servers
(Or How to set up a fully working Joomla, Drupal, LAMP, LAPP, Zimbra, Torrent server etc., in a couple of minutes)
Turnkey Linux comprises a set of free, Ubuntu-based software appliances that are primarily available for server-type usage scenarios, such as setting up database, web, forum, wiki and photo gallery servers. Each appliance is preconfigured to work out of the box, with ease of use being the primary goal behind the Turnkey Linux project.
This is extremely useful in itself, but if you wanted to experiment with these appliances, potentially to evaluate or otherwise test them, it would be great if you could perform installations with the absolute minimum of effort.
Using Turnkey Linux on Virtual Private Servers
A number of hosting providers out there provide Linux VPS services, which usually enable users to have their own virtual server with automatic provisioning of major Linux distributions, such as Debian, Ubuntu or CentOS. Work has been performed in conjunction with the Turnkey Linux team and has managed to take the automatic installation concept one step further to enable this to work with all Turnkey Linux appliances. This is made possible by using frameworks provided by the excellent server open source control panel, DTC.
Turnkey Linux appliances enable users to easily deploy primarily web-based applications within an entire Linux kernel and Ubuntu-based package set. Once a distribution is chosen within the control panel, the install is fully completed within a few minutes and ready to be customised. This enables a rapid deployment of a tested setup, with full update and security support provided by the Turnkey Linux and Ubuntu package maintainers.
Our efforts are available to all using the DTC control panel, with Debian packages for Lenny being provided. Additionally, scripts have been written such that when new or updated appliances are released, new deployable packages for the DTC control panel are created and made available in our repository automatically.
Technical Script Details
It is not actually too difficult to configure images to work for automatic deployment, but performing this manually for every appliance is a time consuming process. The scripts we have written will automatically perform the following steps for each appliance:
- Create a new directory with a name similar to the actual release version, e.g. turnkey-core-2009.02-hardy-x86.
- Copy across common template files. These include the following:
- custom_os: Customises each appliance by configuring basic networking, spawning gettys on the right devices and setting a customised MOTD with the VPS number and hostname.
- install_os: Custom instructions to install this appliance, which essentially involves untaring the provided image into the VPS.
- setup_network: Custom instructions called when setting up the network. Because Turnkey Linux uses resolveconf for DNS configuration, this reads information from /etc/resolv.conf from the dom0 (this is designed for use with Xen) and copies it to /etc/network/interfaces in the domU.
- debian/*: These are the files changelog, control, compat, copyright, files, install and rules which are required to create a.deb packages. These have substitution variables (e.g. for the package name) which are overwritten by our script.
- Copy the preinstalled image (a.tar.bz2 file).
- Tailor the template files (as above).
- Invoke dpkg-buildpackage in this directory to create the actual.deb file.
- Call reprepro, a tool we use to manage Debian repository directory structures, to remove old versions of this appliance and add the new one.
It’s as simple as that. If you are interested, the raw scripts are downloadable. They will need some customisation for your setup as there are hard coded directories in there.
I want to play with one!
If you are happy playing with just one appliance, you can of course just download it from the Turnkey Linux website and install it on your PC (or use a Virtualisation solution like Xen or VMWare).
However, if you want to rapidly try out a variety of appliances using the setup we have made, the quickest way would be to rent a VPS. Alternately, you can install the DTC control panel yourself and add our Debian repository to your /etc/apt/sources.list. This setup requires you to run a fully featured Xen setup and requires significant configuration.
Any questions?