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.

2.1.1.1. 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
centos-6-x86_64                    2012-05-10 13:16:43

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
centos-6-x86_64                    :CentOS 6 (for Intel EM64T) EZ OS Template

2.1.1.2. 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
fedora-23-x86_64                   factory
sles-11-x86_64                     factory
sles-12-x86_64                     factory
suse-42.1-x86_64                   factory
suse-42.2-x86_64                   factory
vzlinux-6-x86_64                   factory

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

  1. Install the template package. For example:

    # vzpkg install template sles-11-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 11 template for container creation, you additionally need to set the $RCE parameter and SUSE repository credentials (obtained from the SUSE Customer Center) in the /etc/vztt/url.map file:

    $RCE            %24RCE
    $SLES11_PASS    <password>
    $SLES11_USER    <user>
    
  3. Create the template cache:

    # vzpkg create cache sles-11-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 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

Note

  1. 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).
  2. For information on creating containers with preinstalled applications, see Using Golden Image Functionality.

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).

Note

Before installing Windows Server 2012 (not R2) in a virtual machine, you need to manually mount the floppy_win8.vfd image file with the needed drivers by running the prlctl set --device set ffd0 --image <path_to_file> command. In Virtuozzo 7.0.4 (Update 4), the image is located in the /usr/share/vz-guest-tools directory, so the command is prlctl set --device set ffd0 --image /usr/share/vz-guest-tools/floppy_win8.vfd.

When choosing a distribution to install, have in mind that Virtuozzo 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 following guest operating systems have been tested and are supported in virtual machines and containers.

2.1.4.1. Virtual Machines

  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2012
  • Windows Server 2008 R2 with Service Pack 1
  • CentOS 7.x (x64)
  • CentOS 6.x (x64)
  • Debian 9.x (x64)
  • Debian 8.x (x64)
  • Ubuntu 18.04 (x64)
  • Ubuntu 17.10 (x64)
  • Ubuntu 16.04 LTS (x64)
  • Ubuntu 14.04 LTS (x64)
  • Virtuozzo Linux 7.x (x64)
  • CloudLinux 7.x (x64)
  • CloudLinux 6.x (x64)

2.1.4.2. Containers

  • CentOS 7.x (x64)
  • CentOS 6.x (x64)
  • Debian 9.x (x64)
  • Debian 8.x (x64)
  • Ubuntu 18.04 (x64)
  • Ubuntu 17.10 (x64)
  • Ubuntu 16.04 LTS (x64)
  • Ubuntu 14.04 LTS (x64)
  • Virtuozzo Linux 7.x (x64)
  • Virtuozzo Linux 6.x (x64)
  • openSUSE 42.x (x64)
  • SUSE Linux Enterprise Server 12 Service Pack 1 (x64)
  • SUSE Linux Enterprise Server 11 Service Pack 1, 2, 3, 4 (x64)