Application Templates

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search

Abstract[edit]

Application Templates (AT's) are commonly found when using Virtualization as a means to try out new software without having to perform a full manual install. Unfortunately, OpenVZ, as of yet, doesn't have any precreated AT's for people to try out, which might be attributed to the lack of documentation on how to create them. The primary goal of this howto is to give an overview of how an AT can be created for OpenVZ without too much trouble. This howto assumes the user is familiar with basic OpenVZ terminology and operation, so basic tasks such as setting VE memory, networking parameters, package repositories, etc are not covered here.

Introduction[edit]

There are two ways to create an AT: as a full VE template, or an interactive shell script/installer that installs the software into an existing VE. The second method is more advanced, and will be very specific to the individual applications, so is out of the scope of this document.

Step 1: The Base[edit]

Choose the base OS you'd like to use and find an existing VE template to use (or create your own). For this document, I'm using the CentOS 5 x86_64 template and will be installing Ruby-on-Rails.

Creating the bare VE[edit]

vzctl create 3000 --ostemplate centos-5-x86_64-default-5.2-20081107 --hostname RoR-AT 
vzctl set 3000 --userpasswd root:<whatever> --save

Step 2: Software Installation[edit]

This is the part where you'll follow the application specific installation procedures. Make sure that you install all the dependancies and do a proper configuration so that the application is usable. In regards to Ruby-on-Rails, I found a good guide on installing RoR on CentOS here.

Step 3: Package the Software[edit]

Once you have everything installed and configured, packaging is a simple procedure:

  • Remove any unecessary files (e.g. /tmp /var/tmp /usr/src/, any downloaded files, etc)
  • Stop the VE
vzctl stop 3000
  • Create a tar.gz of the /vz/private/$VEID directory
cd /vz/private/$VEID && tar cvzf /vz/template/cache/centos-5-x86_64-RoR-AT-11152008.tar.gz ./ 
  • Done

Step 4: Deployment/Distribution[edit]

To do rapid deployment of your new AT, you can utilize for/while loops to create multiple VE's as shown here.

As for distribution, please share any of the AT's you create here