Previous page

Next page

Locate page in Contents

Print this page

Using Customized OS EZ Templates

Let us first start with making 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 Parallels Server Bare Metal 5.0Templates 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 server.

  2. Create one or more scripts that will be executed on different stages of the OS EZ template lifecycle 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: The full list of options allowing you to specify what scripts are to be executed on what stage of the EZ template lifecycle is provided in the vzmktmpl subsection of the Parallels Containers 4.6 Line Reference Guide .

  4. Install the customized OS EZ template on the server 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 Parallels Server Bare Metal 5.0 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 server.
  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 server.
  4. Execute the following command on the server 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 will create 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 server:

    # 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

    ...

    Complete!

    Packing cache file centos_customized-5-x86.tar.gz ...

    Cache file centos_customized-5-x86.tar.gz [14M] created.

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

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

    -–config basic

    Creating Container private area (centos_customized-5-x86)

    Container is mounted

    Postcreate action done

    Container is unmounted

    Container private area was created

    Delete port redirection

    Adding port redirection to Container(1): 4643 8443

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