Difference between revisions of "Configuring container creation"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(New page: The creation of a VE needs three configuration files: <pre>/etc/vz/vz.conf /etc/vz/dists/<dist>.conf /etc/vz/conf/ve-<parameters>.conf-sample</pre> There are two important lines in the fi...)
 
(update category)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The creation of a VE needs three configuration files:
+
The creation of a container with vzctl needs three configuration files:
<pre>/etc/vz/vz.conf
+
* <code>/etc/vz/vz.conf</code>
/etc/vz/dists/<dist>.conf
+
* <code>/etc/vz/dists/''distro-name''.conf</code>
/etc/vz/conf/ve-<parameters>.conf-sample</pre>
+
* <code>/etc/vz/conf/ve-''config-name''.conf-sample</code>
  
There are two important lines in the file <code>/etc/vz/vz.conf</code>. The first is '''DEF_OSTEMPLATE="<dist>"'''; an example of '''<dist>''' is: '''fedora-8-i386-minimal'''. It provides the name of the tar file of VE template cache: <code>/vz/template/cache/<dist>.tar.gz</code>. This line gives the distribution config file as well, because unfortunately all distributions do not work the same way when setting the host name or the ip address. Several tries are done to find this configuration file name: if '''<dist>''' is '''fedora-8-i386-minimal''', then first guest will be <code>/etc/vz/dists/fedora-8-i386-minimal.conf</code>, second will be <code>/etc/vz/dists/fedora-8-i386.conf</code>, third <code>/etc/vz/dists/fedora-8.conf</code>, and finally <code>/etc/vz/dists/fedora.conf</code>. If not found, the <code>/etc/vz/dists/default.conf</code> will be used.
+
== /etc/vz/vz.conf ==
 +
There are two important lines in the file <code>/etc/vz/vz.conf</code>.
  
The other important line in the file <code>/etc/vz/vz.conf</code> is '''CONFIGFILE="<parameters>"'''. It provides the name of the VE parameters file: <code>/etc/vz/conf/ve-<parameters>.conf-sample</code>, for example: <code>/etc/vz/conf/ve-light.conf-sample</code>. During VE creation, a copy of this file will be done with the '''<ve_id>''', for example <ve_id>=123: <code>/etc/vz/conf/123.conf</code>. Whenever a parameter is changed for this VE ('''vzctl set <ve_id> --parameter newValue --save'''), '''parameter="newValue"''' is saved in <code>/etc/vz/conf/<ve_id>.conf</code>.
+
=== DEF_OSTEMPLATE ===
 +
The first is '''DEF_OSTEMPLATE="''distro''"''' sets the default distribution used for container creation (i.e a default for <code>--ostemplate</code> argument). An example of ''distro'' is '''fedora-8-i386-minimal'''.
  
Once those three files are correctly set, creating a new VE is just the command: '''vzctl create <ve_id>'''.
+
First, this provides the name of the tar file of container template cache: <code>/vz/template/cache/''distro''.tar.gz</code>.
 +
 
 +
Also, it gives the distribution configuration file, because unfortunately all distributions do not work the same way when setting the host name or the IP address. Several tries are done to find this configuration file name. Say, if ''distro'' is '''fedora-8-i386-minimal''', then the following files are tried, in sequence:
 +
* <code>/etc/vz/dists/fedora-8-i386-minimal.conf</code>
 +
* <code>/etc/vz/dists/fedora-8-i386.conf</code>
 +
* <code>/etc/vz/dists/fedora-8.conf</code>
 +
* <code>/etc/vz/dists/fedora.conf</code>.
 +
 
 +
If not found, the <code>/etc/vz/dists/default.conf</code> is used (and the appropriate warning printed).
 +
 
 +
Information about the settings contained in these files can be found in <code>/etc/vz/dists/distribution.conf-template</code>.
 +
 
 +
=== CONFIGFILE ===
 +
The other important line in the file <code>/etc/vz/vz.conf</code> is '''CONFIGFILE="''config-name''"'''. It provides the name of the container configuration file: <code>/etc/vz/conf/ve-''config-name''.conf-sample</code> (for example, <code>/etc/vz/conf/ve-light.conf-sample</code>).
 +
 
 +
During container creation, this configuration file is copied to <code>''CTID''.conf</code>, for example, with CTID of 123: <code>/etc/vz/conf/123.conf</code>.
 +
 
 +
Whenever a parameter is changed for this container ('''vzctl set CTID --parameter newValue --save'''), '''parameter="newValue"''' line is added to (or replaced in) <code>/etc/vz/conf/''CTID''.conf</code>.
 +
 
 +
Once those three files are correctly set, creating a new container is just the command:
 +
vzctl create CTID
 +
 
 +
[[Category: Installation]]
 +
[[Category: HOWTO]]

Latest revision as of 06:42, 7 June 2015

The creation of a container with vzctl needs three configuration files:

  • /etc/vz/vz.conf
  • /etc/vz/dists/distro-name.conf
  • /etc/vz/conf/ve-config-name.conf-sample

/etc/vz/vz.conf[edit]

There are two important lines in the file /etc/vz/vz.conf.

DEF_OSTEMPLATE[edit]

The first is DEF_OSTEMPLATE="distro" sets the default distribution used for container creation (i.e a default for --ostemplate argument). An example of distro is fedora-8-i386-minimal.

First, this provides the name of the tar file of container template cache: /vz/template/cache/distro.tar.gz.

Also, it gives the distribution configuration file, because unfortunately all distributions do not work the same way when setting the host name or the IP address. Several tries are done to find this configuration file name. Say, if distro is fedora-8-i386-minimal, then the following files are tried, in sequence:

  • /etc/vz/dists/fedora-8-i386-minimal.conf
  • /etc/vz/dists/fedora-8-i386.conf
  • /etc/vz/dists/fedora-8.conf
  • /etc/vz/dists/fedora.conf.

If not found, the /etc/vz/dists/default.conf is used (and the appropriate warning printed).

Information about the settings contained in these files can be found in /etc/vz/dists/distribution.conf-template.

CONFIGFILE[edit]

The other important line in the file /etc/vz/vz.conf is CONFIGFILE="config-name". It provides the name of the container configuration file: /etc/vz/conf/ve-config-name.conf-sample (for example, /etc/vz/conf/ve-light.conf-sample).

During container creation, this configuration file is copied to CTID.conf, for example, with CTID of 123: /etc/vz/conf/123.conf.

Whenever a parameter is changed for this container (vzctl set CTID --parameter newValue --save), parameter="newValue" line is added to (or replaced in) /etc/vz/conf/CTID.conf.

Once those three files are correctly set, creating a new container is just the command:

vzctl create CTID