10.12. Creating Configuration Files for New Linux Distributions

Distribution configuration files are used to distinguish among containers running different Linux versions and to determine what scripts should be executed when performing the relevant container-related operations (e.g., assigning a new IP address to the container).

All Linux distributions shipped with Virtuozzo Hybrid Server have their own configuration files located in the /usr/libexec/libvzctl/dists/ directory on the hardware node. However, you may wish to create your own distribution configuration files to support new Linux versions released. Let us assume that you wish your containers to run the CentOS 7 Linux distribution and, therefore, have to make the centos-7.conf distribution configuration file to define what scripts are to be executed while performing major tasks with containers running this Linux version. To do this:

  1. In the container configuration file (with the name of /etc/vz/conf/<UUID>.conf), specify centos-7 as the value of the DISTRIBUTION variable (for example, DISTRIBUTION="centos-7").

  2. Create the centos-7.conf configuration file in the /usr/libexec/libvzctl/dists/ directory. The easiest way to do it is copy one of the existing configuration files by executing the following command in the /usr/libexec/libvzctl/dists/ directory:

    # cp fedora.conf centos-7.config
    

    In the example above, we assume that the fedora.conf file is present in the /usr/libexec/libvzctl/dists/ directory on the hardware node. In case it is not, you may use any other distribution configuration file available on your server.

  3. Open the centos.conf file for editing, go to the first entry and, in the right part of the entry, specify the name of the script you wish to be run on issuing the prlctl command with the parameter specified in the left part of the entry. For example, if you wish the script to be executed while assigning a new IP address to your container and the script has the my_centos_script name, your entry should look as follows:

    ADD_IP=my_centos_script-add_ip.sh
    
  4. Repeat Step 3 for all entries in the file.

  5. Place the scripts for the new Linux distribution to the /usr/libexec/libvzctl/dists/scripts directory on the Node. Make sure the names of these scripts coincide with those specified in the centos-7.conf file.