Previous page

Next page

Locate page in Contents

Print this page

Using Customized Application Templates

If the number of customized applications inside your Containers is relatively small, you can also use the following way of creating customized Containers:

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

    Note: Detailed information on how to create metafiles is given in the Creating Metafiles for EZ Templates section of the Virtuozzo 6 Templates Management Guide.

  2. Create one or more scripts that will be executed on different stages of the application EZ template lifecycle and customize your applications to meet your demands. 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 your application after installing this application in your Container.
  3. Create a customized application 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 customize your application in accordance with your needs after installing it in 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 section of the Virtuozzo Containers 6 Reference Guide.

  4. Install the customized EZ template on the server using the rpm -i command.
  5. Create a new Container configuration sample file and include the customized EZ template in this file. Detailed information on Container configuration sample files is provided in the Managing Container Resources Configuration section.
  6. Create a customized Container on the basis of the configuration sample.

The following example demonstrates how to create Container 101 that will run CentOS 5 and have the customized mysql application installed right after its creation:

  1. Create a metafile for the mysql application, name it mysql.metafile, and save in the /usr/mysql directory on the server.
  2. Make a script that will perform a number of custom operations after applying the mysql EZ template to the Container, and name it post_install.bash.
  3. Copy the script to the /usr/mysql directory on the server.
  4. Execute the following command on the server to create the mysql EZ template:

    # vzmktmpl /usr/mysql/mysql.metafile --post-install /usr/mysql/post_install.bash

    This command will create an EZ template for the mysql application and put it to the /root directory (e.g., /root/mysql-centos-5-x86-ez-4.0.0-17.swsoft.noarch.rpm).

  5. Install the mysql EZ template on the server. Using the example above, you can install the template as follows:

    # rpm -ihv /root/mysql-centos-5-x86-ez-4.0.0-17.swsoft.noarch.rpm

  6. Create a new Container configuration sample file and add the mysql EZ template to a list of templates that will be installed in Containers created on the basis of this configuration sample file.
  7. Create Container 101 by using the prlctl create command and the mysql sample file:

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

So, you have just created Container 101 that already has the customized mysql application installed.