2.1. Creating Virtual Machines and Containers

This section explains how to create new Virtuozzo virtual machines and containers using the prlctl create command. The options you should pass to this command differ depending on whether you want to create a virtual machine or container.

2.1.1. Choosing OS EZ Templates for Containers

Before creating a container, you need to choose an OS EZ template it will be based on. Listing OS EZ Templates

To find out which OS EZ templates are already installed on the hardware node and cached (i.e. ready to be used), you can use the vzpkg list command. For example:

# vzpkg list -O
almalinux-8-x86_64                 2022-12-27 16:57:59

The timestamp next to an OS EZ template indicates when the template was cached.

Adding the -O option to the vzpkg list command, you can list only those OS EZ templates which are installed but not cached. You can also add the --with-summary option to display brief template descriptions:

# vzpkg list -O --with-summary
almalinux-8-x86_64                :AlmaLinux 8 (for AMD64/Intel EM64T) Virtuozzo Template
<...> Installing and Caching OS EZ Templates

Some of the supported OS EZ templates may not be preinstalled, so you may need to perform additional steps before you can create containers based on these templates. To list templates available for installation in the official remote repositories, run the following command:

# vzpkg list --available
sles-15-x86_64                     virtuozzo-os

To prepare a template for container creation, do the following:

  1. Install the template package. For example:

    # vzpkg install template sles-15-x86_64
  2. Configure additional template parameters if needed. Some of the EZ templates may require specific preparation steps that depend on the operating system. To prepare, for example, a SLES 15 template for container creation, you additionally need to do the following:

    1. Obtain twelve keys from the installed system by copying them in the etc/zypp/repos.d/ directory:

      cd /etc/zypp/repos.d/
      grep 'https://updates.suse.com/SUSE/Products/SLE-Module-Basesystem/15-SP2/x86_64/\
      product?'; *.repo $SLES_KEY_REL
      grep 'https://updates.suse.com/SUSE/Updates/SLE-Module-Basesystem/15-SP2/x86_64/\
      update?'; *.repo $SLES_KEY_UPD
      grep 'https://updates.suse.com/SUSE/Products/SLE-Product-SLES/15-SP2/x86_64/\
      product?'; *.repo $SLES_KEY_PRO
      grep 'https://updates.suse.com/SUSE/Updates/SLE-Product-SLES/15-SP2/x86_64/\
      update?'; *.repo $SLES_KEY_PRU
      grep 'https://updates.suse.com/SUSE/Products/SLE-Module-Server-Applications/15-SP2/\
      x86_64/product?' *.repo $SLES_SERVER_REPO
      grep 'https://updates.suse.com/SUSE/Updates/SLE-Module-Server-Applications/15-SP2/\
      x86_64/update?' *.repo $SLES_SERVER_UPDATES
      grep 'https://updates.suse.com/SUSE/Products/SLE-Module-Web-Scripting/15-SP2/x86_64/\
      product?'; *.repo $SLES_KEY_WEB_PRO
      grep 'https://updates.suse.com/SUSE/Updates/SLE-Module-Web-Scripting/15-SP2/x86_64/\
      update?'; *.repo $SLES_KEY_WEB_UPD
      grep 'https://updates.suse.com/SUSE/Products/SLE-Module-Development-Tools/15-SP2/\
      x86_64/product?'; *.repo $SLES_KEY_DEV_PRO
      grep 'https://updates.suse.com/SUSE/Updates/SLE-Module-Development-Tools/15-SP2/\
      x86_64/update?'; *.repo $SLES_KEY_DEV_UPD
      grep 'https://updates.suse.com/SUSE/Products/SLE-Module-Legacy/15-SP2/x86_64/\
      product?'; *.repo $SLES_KEY_LEG_PRO
      grep 'https://updates.suse.com/SUSE/Updates/SLE-Module-Legacy/15-SP2/x86_64/\
      update?'; *.repo $SLES_KEY_LEG_UPD
    2. Add the obtained keys to the /etc/vztt/url.map file:

      echo "$SLES_KEY_REL <obtained_key_1>" >> /etc/vztt/url.map
      echo "$SLES_KEY_UPD <obtained_key_2>" >> /etc/vztt/url.map
      echo "$SLES_KEY_PRO <obtained_key_3>" >> /etc/vztt/url.map
      echo "$SLES_KEY_PRU <obtained_key_4>" >> /etc/vztt/url.map
      echo "$SLES_SERVER_REPO <obtained_key_5>" >> /etc/vztt/url.map
      echo "$SLES_SERVER_UPDATES <obtained_key_6>" >>/ etc/vztt/url.map
      echo "$SLES_KEY_WEB_PRO <obtained_key_7>" >> /etc/vztt/url.map
      echo "$SLES_KEY_WEB_UPD <obtained_key_8>" >> /etc/vztt/url.map
      echo "$SLES_KEY_DEV_PRO <obtained_key_9>" >> /etc/vztt/url.map
      echo "$SLES_KEY_DEV_UPD <obtained_key_10>" >> /etc/vztt/url.map
      echo "$SLES_KEY_LEG_PRO <obtained_key_11>" >> /etc/vztt/url.map
      echo "$SLES_KEY_LEG_UPD <obtained_key_12>" >>/ etc/vztt/url.map

      You may also need to set the SUSE repository credentials (obtained from the SUSE Customer Center) in the /etc/vztt/url.map file as follows:

      $SLES_LOGIN     <user>
      $SLES_PASSWORD  <password>
    3. Copy certificates from the installed system to the /vz/template/sles/15/x86_64/config/os/default/files/ directory:

      trust extract --format=openssl-directory --filter=ca-anchors --overwrite /tmp/certs/
      scp -r /tmp/certs/* root@<your-node-ip>:/vz/template/sles/15/x86_64/config/os/default/files/
  3. Create the template cache:

    # vzpkg create cache sles-15-x86_64

Now you can create containers based on the prepared template.

2.1.2. Creating Containers

To create a container, use the prlctl create command as follows:

# prlctl create MyCT --vmtype ct

Virtuozzo Hybrid Server will create a new container with the name MyCT using the default parameters from the global configuration file /etc/vz/vz.conf.

If you want to create a container with a guest OS different from the default specified in the global configuration file, add the --ostemplate option after the prlctl create command. For example:

# prlctl create MyCT --vmtype ct --ostemplate centos-6-x86_64

All container contents will be stored in this container’s private area. To find out where the private area is located, use the prlctl list command as follows:

# prlctl list MyCT -i | grep "Home"
Home: /vz/private/26bc47f6-353f-444b-bc35-b634a88dbbcc

Take note of the following:

  • The first time you install an operating system in a container, its cache is created. To create a cache, you need to have an active Internet connection to access repositories that contain packages for the respective operating system. You can also set up a local package repository and use this repository to provide packages for your operating system. A local package repository is also required for some commercial distributions (e.g., for Red Hat Enterprise Linux).

  • For information on creating containers with preinstalled applications, see Using Golden Images. Prerequisites for Creating Red Hat Enterprise Linux Containers

Creating Red Hat Enterprise Linux containers requires certificates to be present on the host. You will need a working Red Hat Enterprise Linux 7, 8, or 9 installation. You can use the same certificates for these three versions.

Do the following before creating such containers:

  1. Find the certificate paths in the repository file, for example, /etc/yum.repos.d/redhat.repo:

    sslcacert = /etc/rhsm/ca/redhat-uep.pem
    sslclientkey = /etc/pki/entitlement/4662537897317115958-key.pem
    sslclientcert = /etc/pki/entitlement/4662537897317115958.pem
  2. Copy these certificates to /etc/rhel/ on the host where you will be creating Red Hat Enterprise Linux containers.

  3. Rename the copied certificates as follows:


2.1.3. Creating Virtual Machines

Creating a new virtual machine means creating a VM configuration based on a distribution you specified. To create VMs, use the prlctl create command. For example:

# prlctl create MyVM --distribution centos7 --vmtype vm

This command creates a configuration for a virtual machine MyVM, adjusts it for running the CentOS 7 guest OS, and places all the required files in the /vz/vmprivate/<UUID> directory.

Once the virtual machine configuration is ready, you will need to install a supported guest OS in it (e.g., via VNC as described in Enabling VNC Access to Virtual Machines and Containers).


To install a Windows guest in a virtual machine, you will need to manually mount a corresponding image file to VM’s virtual floppy drive using the command prlctl set --device-set fdd0 --image <image_file>. The images are located in /usr/share/vz-guest-tools/ and are typically named to match the guest OS name. For Windows Server 2012 (not R2), however, choose floppy_win8.vfd.

When choosing a distribution to install, have in mind that Virtuozzo Hybrid Server supports VM guest initialization via cloud-init, so you can perform some of the initial configuration tasks on stopped virtual machines. To be able to use this feature, you can install a “cloud-enabled” distribution instead of a regular one. For more information, see Using cloud-init for Virtual Machine Guest Initialization.

2.1.4. Supported Guest Operating Systems

The list of guest operating systems supported in virtual machines and containers is provided in the Virtuozzo Hybrid Server Supported Guest Operating Systems Guide.