Previous page

Next page

Locate page in Contents

Print this page

Creating Metafiles

In the second step, you make a metafile, a plain text file having the .metafile extension and containing a list of parameters for your template. The vzmktmpl utility uses this file when creating the template.

The following example demonstrates the process of creating a metafile for the CentOS 6 x64 OS template. To create the metafile:

  1. Create a new text file with an arbitrary name and the.metafile extension (e.g., centos-6-custom.metafile).

    The easiest way to create a new metafile is to copy one of the metafile samples from the /usr/share/vztt/samples directory and configure it to meet your demands. For example, you can use the /usr/share/vztt/samples/centos-6-x86_64/metafile file as the basis for creating your new metafile for CentOS 6.

    # cp /usr/share/vztt/samples/centos-6-x86_64/metafile /home/user1

  2. Configure the metafile to meet your demands:
    1. %osname. Specify the name of the Linux distribution for which you are creating the OS EZ template:

      %osname

      centos-custom

      The specified name will be assigned to the template directory where you will install the template (e.g., in our case, it will be /vz/template/centos-custom).

    2. %osver. Specify the version of the Linux distribution for which you are creating the template:

      %osver

      6

      The specified name will be assigned to the subdirectory that will denote the version of your Linux distribution (e.g., /vz/template/centos-custom/6).

    3. %osarch. Provide the information about the microprocessor architecture where the OS EZ template is to be run:

      %osarch

      x86_64

      You can set the value of the %osarch parameter to one of the following:

      * x86: specify if you plan to run the template on x86 platforms.

      * x86_64: specify if you plan to use the template on x86-64 platforms.

      As the template being created is intended for use on x86-64-bit platforms, the %osarch parameter is set to x86_64.

    4. %packages. Indicate the packages to include in the template.

      The names of the packages must correspond to the names of real packages (with or without package versions, for example, wget or wget=1.9.1) that are stored in the repository used for the OS template (in our case, for CentOS 5). The specified packages will be downloaded from the package repository and installed on the server when you will cache the OS template.

      Note: If you are creating a template for Debian-based distributions (e.g., Debian, Ubuntu), you need to specify in this step three parameters: %packages_0, %packages_1, and %packages. This is explained by the fact that the installation of such distributions is carried out in three stages. If you do not know which packages to include, consult the documentation for the respective distribution.

    5. %package_manager. Specify the package manager to use for handling the template.

      %package_manager

      rpm47x64

      For the full list of package managers, see Available Package Managers below.

    6. %repositories. Define the list of repositories storing packages for the template:

      %repositories

      $CE_SERVER/centos/6/os/x86_64

      $CE_SERVER/centos/6/updates/x86_64

      All the listed parameters are mandatory and must be specified in any metafile. You can also set a number of supplementary parameters in your metafile (e.g., version and release). For detailed information on all available parameters, see the vzpkg.metafile manual pages. For metafile samples, go to the /usr/share/vztt/samples directory and look for the metafile file in the subdirectory corresponding to specific Linux distributions (e.g., /usr/share/vztt/samples/centos-6-x86_64/metafile).

  3. Save the file.

Metafiles for Application Templates

The example above explains in detail how to create a metafile for an OS template. The process of creating a metafile for an application template is similar to that described above, except for the following:

  • Add the %appname parameter to the file to specify a name for the application template, for example:

    %appname

    php-customized

  • Do not include the %package_manager, %upgradable_versions, and %distribution parameters in the file. These parameters are allowed for OS templates only.
  • Make sure that the value of the %osname parameter corresponds to the name of the directory of the Linux distribution under which the application template is to be run. For example, if you are creating an application template for CentOS 6 installed in the /vz/template/centos directory, set this value to centos:

    %osname

    centos

  • Ensure that the value of the %osver parameter corresponds to the version of the respective Linux distribution. For example, for CentOS 6 installed in the /vz/template/centos/6 directory, set this value to 6:

    %osver

    6

Available Package Managers

Depending on the Linux distribution for which you are creating the template, set the following values for the package_manager parameter:

x86 Linux distributions

  • rpm49db5x86: Fedora 17
  • rpm49x86: Fedora 15 and 16
  • rpm47x86: Red Hat Enterprise Linux 6 and CentOS 6
  • rpm44x86: Red Hat Enterprise Linux 5 and CentOS 5
  • rpm43x86: Red Hat Enterprise Linux 3 and 4, CentOS 3 and 4
  • rpmzypp44x86: SUSE Linux Enterprise Server 11 with Service Pack 2
  • rpm41x86: SUSE Linux Enterprise Server 10 and SUSE Linux 10.x
  • rpm41s9x86: SUSE Linux Enterprise Server 9
  • rpmzypp49x86: openSUSE 12.1
  • dpkg: Debian and Ubuntu

x86-64 Linux distributions

  • rpm49db5x64: Fedora 17
  • rpm49x64: Fedora 15 and 16
  • rpm47x64: Red Hat Enterprise Linux 6 and CentOS 6
  • rpm44x64: Red Hat Enterprise Linux 5 and CentOS 5
  • rpm43x64: Red Hat Enterprise Linux 3 and 4, CentOS 3 and 4
  • rpmzypp44x64: SUSE Linux Enterprise Server 11 with Service Pack 2
  • rpm41x64: SUSE Linux Enterprise Server 10 and SUSE Linux 10.x
  • rpm41s9x64: SUSE Linux Enterprise Server 9
  • rpmzypp49x64: openSUSE 12.1
  • dpkgx64: Debian and Ubuntu