Difference between revisions of "Application Templates"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Step 3: Package the Software: Fix broken command)
(Step 3: Package the Software: fix the tar command)
Line 21: Line 21:
 
:<pre>vzctl stop 3000</pre>
 
:<pre>vzctl stop 3000</pre>
 
*Create a tar.gz of the /vz/private/$VEID directory
 
*Create a tar.gz of the /vz/private/$VEID directory
:<pre>tar cfvz /vz/template/cache/centos-5-x86_64-RoR-AT-11152008.tar.gz ./ </pre>
+
:<pre>cd /vz/private/$VEID && tar cvzf /vz/template/cache/centos-5-x86_64-RoR-AT-11152008.tar.gz ./ </pre>
 
*Done
 
*Done
  

Revision as of 06:10, 3 March 2010

Abstract

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

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

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

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

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

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

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