Previous page

Next page

Locate page in Contents

Print this page

Using Customized OS EZ Templates

You can make a customized base OS EZ template which can then be used to create Containers with a set of application already tuned to meet your demands. To make such a template, do the following:

  1. Create a metafile that will serve as the basis for your customized base OS EZ template.

    Notes:

    1. Detailed information on how to create metafiles is given in the Virtuozzo 6Templates Management Guide.

    2. While creating a metafile for a new OS EZ template, make sure that the value of either the %osname parameter or the %version parameter in the metafile differs from the names or versions of all base OS EZ templates installed on the Hardware Node.

  2. Create one or more scripts that will be executed on different stages of the OS EZ template life cycle and customize your applications to meet your needs. For example, you can create a postinstall script with the name of post_install.bash and make it perform a number of customization operations on some application included in the OS EZ template after installing this application inside your Container.
  3. Create a customized OS EZ template by running the vzmktmpl utility and passing the corresponding options to it. So, you can use the --post-install option and specify the path to the post_install.bash script from the example above to make an OS EZ template that will customize your application after installing it inside your Container.

    Note: For the full list of options allowing you to specify what scripts are to be executed on what stage of the EZ template life cycle, see vzmktmpl in the Virtuozzo 6 Command Line Reference Guide.

  4. Install the customized OS EZ template on the Hardware Node using the rpm -i command.
  5. Cache the created OS EZ template by running the vzpkg create cache command. Detailed information on how you can do it is provided in the Virtuozzo 6 Templates Management Guide.
  6. Create a Container based on the OS EZ template.

For example, to create a Container that will run CentOS 5 and have the customized mysql and apache applications installed right after its creation, you can do the following:

  1. Create a metafile for the Cent OS EZ template, name it, for example, centos_5_customized.metafile, and save in the /root/centos_5 directory on the Hardware Node.
  2. Make a script that will perform a number of custom operations after applying the mysql and apache application EZ templates to the Container, and name it post_install.bash.
  3. Copy the script to the /root/centos_5 directory on the Hardware Node.
  4. Execute the following command on the Hardware Node to create the CentOS 5 OS EZ template:

    # vzmktmpl /root/centos_5/centos_5_customized.metafile --post-install /root/centos5/post_install.bash

    This command creates an OS EZ template for CentOS and put it to the /root directory (for example, /root/centos_customized-5-x86-ez-4.7.0-1.noarch.rpm).

  5. Install the resulting OS EZ template on the Hardware Node:

    # rpm -i /root/centos_customized-5-x86-ez-4.7.0-1.noarch.rpm

  6. Cache the installed OS EZ template:

    # vzpkg create cache centos_customized-5-x86

  7. Create Container 101 on the basis of the new OS EZ template:

    # prlctl create 101 --ostemplate centos_customized-5-x86

So you have just created Container 101 having the customized mysql and apache applications installed inside it.