Difference between revisions of "Modifying openVZ templates"

From Notes_Wiki
m
m
Line 12: Line 12:
#::tar cjf <template-name>.tar.bz2 *
#::tar cjf <template-name>.tar.bz2 *
#:</pre>
#:</pre>
#::'''Read about naming below'''
#Move container template to /vz/private/cache folder
#Move container template to /vz/private/cache folder
#Test new template by creating new container to verify that it is working properly
#Test new template by creating new container to verify that it is working properly
#Optionally delete the container created for modifying template as it is no longer required
#Optionally delete the container created for modifying template as it is no longer required
===Naming openVZ container templates===
The template name must start with same distribution for things to work properly.  For example if original template was centos then the new template must also be named '<tt>centos-&lt;something-new&gt;</tt>'.  There are various distribution specific configuration files in /etc/vz/dists and only if template name starts with same filename as specified here then various post-create, pre-create scripts are used.  For example in case of centos the scripts ensure that various cron tab times are randomized so that all containers do not run their cron jobs at same time.
<yambe:breadcrumb>OpenvZ|OpenvZ</yambe:breadcrumb>

Revision as of 05:00, 7 April 2014

<yambe:breadcrumb>OpenvZ|OpenvZ</yambe:breadcrumb>

Modifying openVZ templates

To modify openVZ template, following steps can be used:

  1. Create a container with base or default template
  2. Start the container
  3. Make necessary modifications such as installing package, configure service to run on start-up, modify configuration files, create users, etc.
  4. Stop the container
  5. Go to container private folder at '/vz/private/<CTID>'
  6. Create container template using
    tar cjf <template-name>.tar.bz2 *
    Read about naming below
  7. Move container template to /vz/private/cache folder
  8. Test new template by creating new container to verify that it is working properly
  9. Optionally delete the container created for modifying template as it is no longer required


Naming openVZ container templates

The template name must start with same distribution for things to work properly. For example if original template was centos then the new template must also be named 'centos-<something-new>'. There are various distribution specific configuration files in /etc/vz/dists and only if template name starts with same filename as specified here then various post-create, pre-create scripts are used. For example in case of centos the scripts ensure that various cron tab times are randomized so that all containers do not run their cron jobs at same time.


<yambe:breadcrumb>OpenvZ|OpenvZ</yambe:breadcrumb>