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
sles-15-x86_64 virtuozzo-os
<...>
To prepare a template for container creation, do the following:
Install the template package. For example:
# vzpkg install template sles-15-x86_64
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:
Obtain six 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/x86_64/product?' \ *.repo $SLES_KEY_REL grep 'https://updates.suse.com/SUSE/Updates/SLE-Module-Basesystem/15/x86_64/update?' \ *.repo $SLES_KEY_UPD grep 'https://updates.suse.com/SUSE/Products/SLE-Product-SLES/15/x86_64/product?' \ *.repo $SLES_KEY_PRO grep 'https://updates.suse.com/SUSE/Updates/SLE-Product-SLES/15/x86_64/update?' *.repo \ $SLES_KEY_PRU grep 'https://updates.suse.com/SUSE/Products/SLE-Module-Server-Applications/15/x86_64/\ product?' *.repo $SLES_SERVER_REPO grep 'https://updates.suse.com/SUSE/Updates/SLE-Module-Server-Applications/15/x86_64/\ update?' *.repo $SLES_SERVER_UPDATES
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
You may also need to set the
$RCE
parameter and SUSE repository credentials (obtained from the SUSE Customer Center) in the/etc/vztt/url.map
file as follows:$RCE %24RCE $SLES_LOGIN <user> $SLES_PASSWORD <password>
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.
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).
Note
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 following guest operating systems have been tested and are supported in virtual machines and containers.
2.1.4.1. Virtual Machines¶
Windows Server 2022
Windows Server 2019
Windows Server 2016
Windows Server 2012 R2
Windows Server 2012
Windows Server 2008 R2 with Service Pack 1
AlmaLinux 8.x
CentOS 8.x
CentOS 7.x
CentOS 6.x
Debian 11.x
Debian 10.x
Debian 9.x
Debian 8.x
Ubuntu 22.04 LTS
Ubuntu 20.04 LTS
Ubuntu 18.04 LTS
Ubuntu 16.04 LTS
Ubuntu 14.04 LTS
Virtuozzo Linux 8.x
Virtuozzo Linux 7.x
CloudLinux 7.x
CloudLinux 6.x
RockyLinux 8.x
2.1.4.2. Containers¶
AlmaLinux 8.x
CentOS 8.x
CentOS 7.x
CentOS 6.x
Debian 11.x
Debian 10.x
Debian 9.x
Debian 8.x
Ubuntu 22.04 LTS
Ubuntu 20.04 LTS
Ubuntu 18.04 LTS
Ubuntu 16.04 LTS
Ubuntu 14.04 LTS
Virtuozzo Linux 8.x
Virtuozzo Linux 7.x
Virtuozzo Linux 6.x
openSUSE 42.x
SUSE Linux Enterprise Server 15 Service Pack 2
SUSE Linux Enterprise Server 12 Service Pack 1
RockyLinux 8.x