Difference between revisions of "Creating OVZ Template"

From vpsget wiki
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Current article describes how to create template from existent OpenVZ container.
+
Current article describes how to create template from existent OpenVZ container using simfs .
  
 
You can do it directly from the SolusVM Admin CP (use "Create template" feature under VirtualServer management tab).
 
You can do it directly from the SolusVM Admin CP (use "Create template" feature under VirtualServer management tab).
Line 13: Line 13:
 
You can clean messages, secure, maillog, etc. You can clean all logs under /vz/private/<VZID>/var/log/
 
You can clean messages, secure, maillog, etc. You can clean all logs under /vz/private/<VZID>/var/log/
  
Create template
+
Create template [assuming you are using simfs]
  tar czf /vz/template/cache/<Template_name>.tar.gz /vz/private/<VZID>/
+
cd /vz/private/<VZID>/
 +
  tar czf /vz/template/cache/<Template_name>.tar.gz ./*
  
 
For example create template for container with ID=344 and Template Name will be "Centos6_LAMP_Webmin"
 
For example create template for container with ID=344 and Template Name will be "Centos6_LAMP_Webmin"
 
  vzctl stop 344
 
  vzctl stop 344
  tar czf /vz/template/cache/Centos6_LAMP_Webmin.tar.gz /vz/private/344/
+
cd /vz/private/344 
 +
  tar czf /vz/template/cache/Centos6_LAMP_Webmin.tar.gz ./*
  
 
After that you should copy the created template file to the Main NODE server and to all other NODES.
 
After that you should copy the created template file to the Main NODE server and to all other NODES.
Line 25: Line 27:
 
    
 
    
 
In solusVM you can copy the newly created template to main server and use "Media Sync" feature to sync the template with all nodes.
 
In solusVM you can copy the newly created template to main server and use "Media Sync" feature to sync the template with all nodes.
 +
 +
<b>NOTE:</b> if you are using <b>ploop</b> dy default you may create the new container with simfs option like:
 +
vzctl create CTID --layout simfs
 +
or try to tar the /vz/root/<VZID>/ instead of /vz/private/<VZID>
 +
  
  

Latest revision as of 12:45, 25 August 2016

Current article describes how to create template from existent OpenVZ container using simfs .

You can do it directly from the SolusVM Admin CP (use "Create template" feature under VirtualServer management tab).

Anyway there exists cases when you need to create it manually. It's quite easy.

First stop container that you want to use as source for OVZ template:

vzctl stop <VZID>

Optional is to clean the logs . You can find logfiles for stopped container in next path:

/vz/private/<VZID> 

You can clean messages, secure, maillog, etc. You can clean all logs under /vz/private/<VZID>/var/log/

Create template [assuming you are using simfs]

cd /vz/private/<VZID>/
tar czf /vz/template/cache/<Template_name>.tar.gz ./* 

For example create template for container with ID=344 and Template Name will be "Centos6_LAMP_Webmin"

vzctl stop 344
cd /vz/private/344  
tar czf /vz/template/cache/Centos6_LAMP_Webmin.tar.gz ./*

After that you should copy the created template file to the Main NODE server and to all other NODES. Put template into (Use the same path on main node server) :

/vz/template/cache/
  

In solusVM you can copy the newly created template to main server and use "Media Sync" feature to sync the template with all nodes.

NOTE: if you are using ploop dy default you may create the new container with simfs option like:

vzctl create CTID --layout simfs

or try to tar the /vz/root/<VZID>/ instead of /vz/private/<VZID>


For more info refer to the OpenVZ official wiki: http://openvz.org/Creating_a_CentOS_6_Template

""