Difference between revisions of "OS template cache preparation"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Alternative: use precreated template cache)
(Alternative: use precreated template cache)
Line 77: Line 77:
 
  [root@localhost tmp]# ERROR: No such OS template: install
 
  [root@localhost tmp]# ERROR: No such OS template: install
  
To fix this, install the appropriate os template metadata on the OpenVZ host, for example
+
This might apply to Fedora also. To fix this problem, install the appropriate os template metadata on the OpenVZ host, for example
  
 
  yum install vztmpl-centos-4
 
  yum install vztmpl-centos-4

Revision as of 15:06, 6 March 2007

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.

Terminology

Please make sure you understand these terms:

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

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

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 Downloads » Templates » Repo Cache; download and untar them to the /vz/template 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.

Note - The cache may be out of date meaning you end up downloading them all again anyway.

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.

Alternative: use precreated template cache

As an alternative to creating a cache using template metadata, you can use precreated template cache taken from Downloads » Templates » Precreated, or directly from download.openvz.org/template/precreated, or from one of the mirrors.

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 /vz/template/cache directory.

NOTE: If you use precreated CentOS-4 templates and wish to install software using vzyum, you will probably run into error like this:

[root@localhost tmp]# vzyum MYVPSID install mypackage
[root@localhost tmp]# ERROR: No such OS template: install

This might apply to Fedora also. To fix this problem, install the appropriate os template metadata on the OpenVZ host, for example

yum install vztmpl-centos-4

Next step

Follow on to the VE creation article.