Using Customized Application Template
If the number of customized applications inside your Containers is relatively small, you can also use the following way of creating customized Containers:
-
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
Parallels Server Bare Metal 5.0 Templates Management Guide
.
-
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.
-
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
Parallels Containers 4.6 Reference Guide
.
-
Install the customized EZ template on the server using the
rpm -i
command.
-
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
.
-
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:
-
Create a metafile for the
mysql
application, name it
mysql.metafile
, and save in the
/usr/mysql
directory on the server.
-
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
.
-
Copy the script to the
/usr/mysql
directory on the server.
-
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
).
-
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.sws
oft.noarch.rpm
-
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.
-
Create Container 101 by using the
pctl create
command and the
mysql
sample file:
# pctl create 101 --ostemplate centos-5-x86 -–config mysql
Creating Container private area (centos-5-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 that already has the customized
mysql
application installed.
|