Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Configuring container creation

537 bytes added, 06:42, 7 June 2015
update category
The creation of a VE container with vzctl needs three configuration files:* <precode>/etc/vz/vz.conf</code>* <code>/etc/vz/dists/''distro-name''.conf<dist/code>.conf* <code>/etc/vz/conf/ve-<parameters>''config-name''.conf-sample</precode>
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 =There are two important lines in 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.
=== DEF_OSTEMPLATE ===The other important line in the file <code>/etc/vz/vz.conf</code> first is '''CONFIGFILEDEF_OSTEMPLATE="<parameters>''distro''"'''. It provides sets the name of the VE parameters file: <code>/etc/vz/conf/ve-<parameters>default distribution used for container creation (i.conf-sample</code>, e a default for example: <code>/etc/vz/conf/ve-light.conf-sampleostemplate</code>argument). During VE creation, a copy An example of this file will be done with the ''distro'<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> -fedora-parameter newValue 8-i386-save'''), ''minimal'parameter="newValue"''' is saved in <code>/etc/vz/conf/<ve_id>.conf</code>.
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 VE container is just the command: ''' vzctl create <ve_id>'''.CTID [[Category: Installation]][[Category: HOWTO]]