Using EZ OS Template Sets
Another way of creating customized Containers is to make a non-base OS EZ template (also known as an OS EZ template set) differing from the corresponding base OS EZ template in the number of packages included in this template. For example, if you wish a Container to run CentOS 5 and to function as a Linux-based server only, you can create the centos-5-x86-server OS EZ template set and include only those packages in it that are needed for performing main server tasks. So, you can specify packages to be used for setting up file and print sharing and exclude all the packages for graphical interfaces (GNOME and KDE).
To create a non-base OS EZ template, do the following:
- Create a metafile that will serve as the basis for your non-base OS EZ template. Any metafile for this kind of EZ template must contain the following information:
%osname : the name of the Linux distribution for which you are creating the OS EZ template set. This name must correspond to that specified in the base OS EZ template. For example, if you are creating an OS template set of the base OS EZ template for CentOS 5, set the value of this parameter to centos .%osver : the version of the Linux distribution specified as the value of the %osname parameter. This name must correspond to that specified in the base OS EZ template. For example, if you are creating an OS template set of the base OS EZ template for CentOS 5, set the value of this parameter to 5 .%osarch : the system architecture where the EZ template is to be run. This name must correspond to that specified in the base OS EZ template. For example, if you are creating an OS template set of the base OS EZ template for CentOS 5, set the value of this parameter to x86 .%setname : the name to be assigned to your non-base OS EZ template. You can specify any name you like for your OS template set:
- This name will be added to the name of the base OS EZ template after the indication of the architecture where the OS EZ template is to be run. For example, if you are creating an OS template set of the base OS EZ template for CentOS 5 that is supposed to run on x86 platforms, the name of your non-base OS EZ template should look like
centos-5-x86- Template_Name -ez-1.0-1.noarch.rpm , where Template_Name is the name you specify as the value of the %setname parameter. - This name will also be assigned to the directory which will store the meta data of your non-base OS EZ template after the template installation on the Hardware Node. For example, it will have the name of
/vz/template/centos/5/x86/config/os/my_non_base_template if you set the value of this parameter to my_non_base_template , create a non-base OS EZ template for CentOS 5, and installed it on the Hardware Node.
%packages : a list of RPM packages to be included in the non-base OS EZ template. This parameter allows you to specify what applications will be present inside your Containers based on this OS EZ template set right after their installation. The names of the packages listed as the value of this parameter must correspond to the names of real RPM packages (without indicating the package version, release, architecture, and the .rpm extension) that are stored in the repository used for managing your EZ templates.Note: You can also specify a number of additional parameters in your metafile. For example, you may wish to add one or several extra packages to your OS EZ template set which are not available in the repository used to handle the packages for the corresponding base OS EZ template. For this purpose, you will have to specify the %mirrorlist parameter providing information on the repository where these extra packages are kept. Detailed information on all parameters you can set in metafiles is given in the Virtuozzo 6 Command Line Reference Guide.
- You can also (though you do not have to) create a number of scripts that will be executed on different stages of the non-base OS EZ template life cycle and customize your applications to meet your demands. The path to these scripts should then be specified after the corresponding options while creating your OS template set. For example, you can create a preinstall script with the name of
pre_install.bash and make it perform a number of customization operations on some application included in the non-base OS EZ template before installing this application in your Container.Note: If there are no scripts for a non-base OS EZ template, the scripts available for the corresponding base OS EZ template will be executed.
- Create the non-base OS EZ template by running the
vzmktmpl utility and passing the corresponding options to it, if needed. So, if you created one or several scripts in the previous step, you can use special options and specify the path to these scripts during the command execution. For example, you can use the --pre-install option and specify the path to the pre_install.bash script to make an OS EZ template that will customize your application before 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.
- Install the non-base OS EZ template on the Hardware Node using the
rpm -i command. - 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. - Create a Container based on the OS EZ template.
|