Difference between revisions of "OS template cache preparation"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(added yum method Installing OS template metadata)
m (Protected "OS template cache preparation": Excessive vandalism ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite)))
 
(34 intermediate revisions by 15 users not shown)
Line 1: Line 1:
This article describes the procedure of an OS template cache creation. Is assumes you already have OpenVZ installed and running. The steps needed to achieve it are documented in the [[Quick installation]] document.
+
This article describes the procedure of an OS template cache preparation. It assumes you already have OpenVZ installed and running. The steps needed to achieve it are documented in the [[Quick installation]] document.
 +
 
 +
== Precreated templates ==
 +
 
 +
Use precreated templates taken from [http://openvz.org/download/template/cache Downloads » Templates » Precreated], or directly from [http://download.openvz.org/template/precreated/ download.openvz.org/template/precreated], or from one of the [[Download mirrors|mirrors]].
 +
 
 +
Precreated templates can be easily updated using the following algorithm:
 +
# create temporary [[container]] based on template
 +
# update [[container]] using OS-specific tools (yum, apt or similar)
 +
# pack [[container]] as a new template
 +
Examples of this procedure are described in details at [[Updating Ubuntu template]], [[Updating Debian template]], [[Fedora template update]]
 +
 
 +
In order to use precreated template cache files, download files for chosen OS distributions and place them as-is (no unpacking needed) to the <tt>/vz/template/cache</tt> directory (for Debian/Ubuntu it might be <tt>/var/lib/vz/template/cache</tt>).
 +
 
 +
== Next step ==
 +
 
 +
Follow on to the [[container creation]] article.
 +
 
 +
= Obsoleted: use template tools =
 +
 
 +
{{Warning|The rest of this document is obsoleted and is kept here for historical purposes only. Template utilities (vzpkg/vzyum) are no longer supported. Use [[Download/template/precreated|precreated templates]].}}
  
 
== Terminology ==
 
== Terminology ==
  
Please make sure you understand these terms:
+
Please make sure you understand the following terms.
  
* [[OS template]]
+
{{:OS template}}
* [[OS template metadata]]
+
{{:OS template metadata}}
* [[OS template cache]]
+
{{:OS template cache}}
  
 
== Creating an OS template cache ==
 
== Creating an OS template cache ==
You can create an [[OS template cache]] using template utilities and [[OS template metadata]] right on your [[hardware node]]. The process it automated and will take from about 10 minutes to a few hours, depending on the network speed, and the result will be most up-to-date template cache.
+
You can create an [[OS template cache]] using template utilities and [[OS template metadata]] right on your [[hardware node]]. The process is automated and will take from about 10 minutes to a few hours, depending on the network speed, and the result will be most up-to-date template cache.
  
 
=== Installing template utilities ===
 
=== Installing template utilities ===
Line 18: Line 38:
 
==== Using yum ====
 
==== Using yum ====
 
<pre>
 
<pre>
# yum install vzpkg vzyum vzrpm43 vzrpm44
+
# yum install vzpkg vzyum vzrpm43-python vzrpm44-python vzctl-lib
 
</pre>
 
</pre>
  
 
==== Using rpm ====
 
==== Using rpm ====
Packages are available from [http://openvz.org/download/template/utils/ Download » Templates » Utilities]. You need both <tt>vzpkg</tt> and <tt>vzyum</tt> packages, as well as one of (or both) <tt>vzrpm43</tt>/<tt>vzrpm44</tt> (including their <tt>-python</tt> counterparts), depending on OS templates being used.
+
Packages are available from [http://openvz.org/download/template/utils/ Download » Templates » Utilities]. You need both <tt>vzpkg</tt> and <tt>vzyum</tt> packages, as well as one or both <tt>vzrpm43</tt>/<tt>vzrpm44</tt> (including their <tt>-python</tt> counterparts), depending on the OS templates being used.
  
 
Install these utilities using rpm:
 
Install these utilities using rpm:
Line 29: Line 49:
 
# rpm -ihv vzpkg*.rpm vzyum*.rpm vzrpm44*.rpm
 
# rpm -ihv vzpkg*.rpm vzyum*.rpm vzrpm44*.rpm
 
</pre>
 
</pre>
 +
 +
In Red Hat Enterprise Linux, to install <tt>vzyum</tt> you will need <tt>[http://rpmfind.net/linux/rpm2html/search.php?query=python-elementtree&system=redhat python-elementtree]</tt>, <tt>[http://rpmfind.net/linux/rpm2html/search.php?query=python-sqlite&system=redhat python-sqlite]</tt>, and <tt>[http://rpmfind.net/linux/rpm2html/search.php?query=python-urlgrabber&system=redhat python-urlgrabber]</tt>. These packages might have dependencies of their own. For example, <tt>python-sqlite</tt> needs <tt>[http://rpmfind.net/linux/rpm2html/search.php?query=sqlite&system=redhat sqlite]</tt>.
  
 
=== Installing OS template metadata ===
 
=== Installing OS template metadata ===
Line 52: Line 74:
 
</pre>
 
</pre>
  
=== Installing repository cache (optional) ===
 
  
Optionally, you may want to get a snapshot of the local copy of the package repository for the chosen OS template(s). This is not required but might speed up the initial OS template cache creation considerably. The tarballs are available from [http://openvz.org/download/template/repocache/ Downloads » Templates » Repo Cache]; download and untar them to the <tt>/vz/template</tt> directory on your OpenVZ [[Hardware Node]]. If you choose to skip this step, all the needed files will be downloaded from the Internet automatically when needed.
 
  
 
=== Running <tt>vzpkgcache</tt> ===
 
=== Running <tt>vzpkgcache</tt> ===
  
Run the <tt>vzpkgcache</tt> utility; see the vzpkgcache(8) man page for details. It will create or update the caches of all the templates for which the corresponding metadata exist.
+
Run the <tt>vzpkgcache</tt> utility; see the vzpkgcache(8) man page for details. It will create or update the caches of all the templates for which the corresponding metadata exist. Before cache creation be sure that you are set up all necessary locales for rpm (see [[Locales inside VE]]).
 
 
== Alternative: use precreated template cache ==
 
  
As an alternative to creating a cache using template metadata, you can use precreated template cache taken from [http://openvz.org/download/template/cache Downloads » Templates » Precreated], or directly from [http://download.openvz.org/template/precreated/ download.openvz.org/template/precreated], or from one of the [[Download mirrors|mirrors]].
+
# vzpkgcache centos-4-i386-minimal
 
 
However, this option is not recommended for production systems since without installing template metadata you will not be able to update your template cache.
 
 
 
In order to use precreated template cache files, download files for chosen OS distributions and place them as-is (no unpacking needed) to the <tt>/vz/template/cache</tt> directory.
 
 
 
== Next step ==
 
  
Follow on to the [[VE creation]] article.
 
  
 
[[Category: Installation]]
 
[[Category: Installation]]
 
[[Category: Templates]]
 
[[Category: Templates]]

Latest revision as of 06:27, 23 October 2011

This article describes the procedure of an OS template cache preparation. It assumes you already have OpenVZ installed and running. The steps needed to achieve it are documented in the Quick installation document.

Precreated templates

Use precreated templates taken from Downloads » Templates » Precreated, or directly from download.openvz.org/template/precreated, or from one of the mirrors.

Precreated templates can be easily updated using the following algorithm:

  1. create temporary container based on template
  2. update container using OS-specific tools (yum, apt or similar)
  3. pack container as a new template

Examples of this procedure are described in details at Updating Ubuntu template, Updating Debian template, Fedora template update

In order to use precreated template cache files, download files for chosen OS distributions and place them as-is (no unpacking needed) to the /vz/template/cache directory (for Debian/Ubuntu it might be /var/lib/vz/template/cache).

Next step

Follow on to the container creation article.

Obsoleted: use template tools

Warning.svg Warning: The rest of this document is obsoleted and is kept here for historical purposes only. Template utilities (vzpkg/vzyum) are no longer supported. Use precreated templates.

Terminology

Please make sure you understand the following terms.

<translate> An OS template is basically a set of packages from some Linux distribution used to populate a container. With OpenVZ, different distributions can co-exist on the same hardware box, so multiple OS templates can be available.

An OS template consists of system programs, libraries, and scripts needed to boot up and run the system (container), as well as some very basic applications and utilities. Applications like a compiler and an SQL server are usually not included into an OS template.

<translate>

Warning.svg Warning: The rest of this document is obsoleted and is kept here for historical purposes only. Template utilities (vzpkg/vzyum) are no longer supported. Use precreated templates.

OS template metadata is a set of a few files containing the following information:

  • List of packages that form this OS template
  • Locations of package repositories
  • Scripts needed to be executed on various stages of template installation
  • Public GPG key(s) needed to check signatures of packages
  • Additional OpenVZ-specific packages

Using OS template metadata and vzpkg tools, an OS template cache can be created.


<translate> An OS template cache is an OS template installed into a container and then packed into a gzipped tarball. Using such a cache, a new container can be created in a matter of minutes, if not seconds.

OS template cache can either be created from OS template metadata using vzpkg tools, or by other means.


Creating an OS template cache

You can create an OS template cache using template utilities and OS template metadata right on your hardware node. The process is automated and will take from about 10 minutes to a few hours, depending on the network speed, and the result will be most up-to-date template cache.

Installing template utilities

You have to install a few packages in order to be able to create/update OS template cache(s).

Using yum

# yum install vzpkg vzyum vzrpm43-python vzrpm44-python vzctl-lib

Using rpm

Packages are available from Download » Templates » Utilities. You need both vzpkg and vzyum packages, as well as one or both vzrpm43/vzrpm44 (including their -python counterparts), depending on the OS templates being used.

Install these utilities using rpm:

# rpm -ihv vzpkg*.rpm vzyum*.rpm vzrpm44*.rpm

In Red Hat Enterprise Linux, to install vzyum you will need python-elementtree, python-sqlite, and python-urlgrabber. These packages might have dependencies of their own. For example, python-sqlite needs sqlite.

Installing OS template metadata

To create an OS template cache, you need to get the metadata for the chosen OS template(s).

Using yum

To see which templates are available, run

# yum search vztmpl

To install some of the templates, run

# yum install vztmpl-XXX [...]

Using rpm

Get the chosen vztmpl-* packages from Downloads » Templates » Metadata (or directly from download.openvz.org/template/metadata or one of the mirrors and install them:

# rpm -ihv vztmpl-*.rpm


Running vzpkgcache

Run the vzpkgcache utility; see the vzpkgcache(8) man page for details. It will create or update the caches of all the templates for which the corresponding metadata exist. Before cache creation be sure that you are set up all necessary locales for rpm (see Locales inside VE).

# vzpkgcache centos-4-i386-minimal