Using Customized OS EZ Template
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, you should perform the following operations:
-
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 4 Bare Metal
Templates Management Guide
.
2. While creating a metafile for your new OS EZ template, you should 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. So, if the base RHEL4 OS EZ template is already installed on your server, these values cannot be simultaneously set to
redhat
and
as4
.
-
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.
-
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 Command Line Reference Guide
.
-
Install the customized OS EZ template on the server by running 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
Parallels Server 4 Bare Metal
Templates Management Guide
.
-
Create a Container based on the OS EZ template.
For example, to create a Container which will run Red Hat Enterprise Linux 4 (RHEL 4) and have the customized
mysql
and
apache
applications installed inside it right after its creation, you can do the following:
-
Create a metafile for the RHEL 4 OS EZ template, name it, for example,
rhel_4_customized.metafile
, and save in the
/root/rhel4
directory on the server.
-
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
.
-
Copy the script to the
/root/rhel4
directory on the server.
-
Execute the following command on the server to create the RHEL 4 OS EZ template:
# vzmktmpl /root/rhel4/rhel_4_customized.metafile \
--post-install /root/rhel4/post_install.bash
This command will create an OS EZ template for RHEL 4 and put it to the
/root
directory (e.g.
/root/redhat_customized-as4-x86-ez-4.0.0-1.swsoft.noarch.rpm
).
-
Install the resulting OS EZ template on the server:
# rpm -i /root/redhat_customized-as4-x86-ez-4.0.0-1.swsoft.noarch.rpm
-
Cache the installed OS EZ template:
# vzpkg create cache redhat_customized-as-x86
...
Complete!
Packing cache file redhat_customized-as4-x86.tar.gz ...
Cache file redhat_customized-as4-x86.tar.gz [14M] created.
-
Create Container 101 on the basis of the new OS EZ template:
# pctl create 101 --ostemplate redhat_customized-as4-x86
-–config basic
Creating Container private area (redhat_customized-as4-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.
|