Previous page

Next page

Locate page in Contents

Print this page

Preparing an OS EZ Template for Container Creation

Although you can create Containers without having to prepare OS EZ templates first, doing so provides more control over the entire process and helps avoid problems which might be caused by a slow Internet connection, for example. OS EZ template preparation includes:

  1. Installing an OS EZ template on the server.
  2. Creating an OS EZ template cache, with or without preinstalled applications.

For details on how to start creating Containers once caching has been done, see the Virtuozzo 6 User's Guide.

Installing OS EZ Templates

To install a new OS EZ template on the server, use the vzpkg install template command. For example, to install the CentOS 6 EZ (x86) template, you can do this:

# vzpkg install template centos-6-x86

Preparing... ################################# [100%]

1:centos-6-x86 ################################# [100%]

You may also want to check that the template has been installed successfully:

# vzpkg list

centos-6-x86

The centos-6-x86 EZ template has been installed on the server in the /vz/template/centos/6 directory.

Note: Before caching OS EZ templates, you may need to set up a local package repository (e.g., for commercial distributions like Red Hat Enterprise Linux). For details on how to manage package repositories, see Setting Up Repositories and Proxy Servers for EZ Templates.

Creating Clean OS EZ Template Caches

You can use a clean OS EZ template cache to create an empty Container without any custom applications installed. To create a clean OS EZ template cache, use the vzpkg create cache command, specifying an OS EZ template to cache:

# vzpkg create cache centos-6-x86

The created archive is put to the /vz/template/cache directory on the server:

# ls /vz/template/cache

centos-6-x86.plain.ploop.tar.lzrw

Creating OS EZ Template Caches with Preinstalled Application Templates

You can use an OS EZ template cache with preinstalled application templates to quickly create multiple identical Containers without having to install applications manually or wait until they are installed automatically to each Container after its creation. The best way to create such a cache is:

  1. Make a custom sample configuration file with information on the OS EZ template to cache and application EZ templates to preinstall. For example:

    # cp /etc/vz/conf/ve-basic.conf-sample /etc/vz/conf/ve-centos-6-x86-mysql-devel.conf-sample

    Note: If you already have a custom sample configuration file created in Server Bare Metal 5 or earlier and having application EZ templates specified in it, you can reuse it instead of creating a new one.

  2. Add the OS EZ template and application EZ template information to the new configuration file. Each OS and application template name must be preceded by a dot. Multiple consecutive application EZ template names must be separated by white spaces. For example:

    # cd /etc/vz/conf

    # echo 'OSTEMPLATE=".centos-6-x86"' >> ve-centos-6-x86-mysql-devel.conf-sample

    # echo 'TEMPLATES=".mysql .devel"' >> ve-centos-6-x86-mysql-devel.conf-sample

  3. Run the vzpkg create appcache command with your configuration file as an option. For example:

    # vzpkg create appcache --config centos-6-x86-mysql-devel

    Note: If the resulting cache already exists, it will not be recreated and you will see a corresponding message.

The resulting archive can be found in the /vz/template/cache directory on the Hardware Node. You can check that it exists and includes necessary application templates with the following command:

# vzpkg list appcache

centos-6-x86 2012-07-20 16:51:36

mysql

devel