OS template cache preparation
This document assumes you already have OpenVZ installed and running. The steps needed to achieve it are documented in the Quick installation document.
Terminology
- OS template
-
An OS template is basically a set of packages from some Linux distribution used to populate a VPS. With OpenVZ, different distributions can co-exist on the same hardware box, so multiple OS templates are available. An OS template consists of system programs, libraries, and scripts needed to boot up and run the system (VPS), 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.
- OS template metadata
-
Template metadata is a set of a few files containing the following information:
- List of packages that form this 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
The metadata for a few OS templates are available for download from Downloads » Templates » Metadata.
- OS template cache
-
An OS template cache is an OS template installed into a VPS and then packed into a gzipped tarball. Using such a cache, a new VPS can be created in a matter of minutes, if not seconds.
Template utilities
You have to install a few packages in order to be able to create/update OS template cache(s). Packages are available from Download » Templates » Utilities. You need both vzpkg and vzyum packages, as well as one of (or both) vzrpm43/vzrpm44 (including their -python counterparts), depending on OS templates being used.
Cache creation
To create an OS template cache, you need to get the metadata for the chosen OS template(s). Get the chosen vztmpl-* packages from Downloads » Templates » Metadata and install them (using rpm -ihv vztmpl-*).
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 Node. If you choose to skip this step, all the needed files will be downloaded from the Internet automatically when needed.
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.
Using precreated template cache
As an alternative to creating a cache using template metadata, you can use precreated template cache taken from Downloads » Templates » Precreated. 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 /vz/template/cache directory.
Follow on to the VPS creation article.