Preparing OS Templates

The process of preparing OS templates is similar on both Virtuozzo and OpenVZ nodes.

There are two kinds of OS templates in the Cloud Infrastructure:

  • Container OS templates
  • Virtual machine OS templates

You do not need to perform any specific operations to prepare container OS templates for using in the Cloud Infrastructure. For detailed information about working with container OS templates, refer to Virtuozzo Templates Management Guide.

At the same time, the process of preparing a virtual machine OS template is a bit more complicated and includes these steps:

  1. Creating and configuring a virtual machine to base the template on.
  2. Creating the template on the basis of the prepared virtual machine.

Both steps are described below in details.

Note:
1. Custom CT OS templates are not propagated automatically across the virtualization nodes in one location. You should copy them manually on the nodes with missing OS templates.
2. Custom VM OS templates, which were created manually on virtualization node, are not propagated automatically between nodes. You should migrate them manually across the nodes if you need them. The hardware nodes should be in one location. For more details how to migrate custom VM OS templates between virtualization nodes in one location, refer to https://kb.cloudblue.com/130011.

Creating and Configuring Virtual Machine

  1. First, you need to create and configure a virtual machine you will base the template on. To do this:

    On virtualization node, create a virtual machine. In the current version of (Undefined variable: Variables.OACI_full), a virtual machine must run one of the following operating systems: CentOS 6 or Windows Server 2012 R2 (Datacenter Edition). You may also try to use other operating systems as the basis for making OS templates, but the Cloud Infrastructure has not been extensively tested with them. For detailed information about creating new virtual machines, refer to Virtuozzo User's Guide >> Managing Virtual Machines and Containers > Creating Virtual Machines and Containers section. You can check the supported OS distributions by running the following command:

    # prlctl create VM_Name --distribution list

    Note:
    1. We recommend that you assign unified, descriptive names for VM OS templates. For example, VM_lin_centos_6_x64 or VM_win_2012_r2_sp2_x64.
    2. Please note that HDD size limitation depends on the type of partition table – Master Boot Record (MBR) or GUID Partition Table (GPT). In case of MBR type, HDD size can be no more than 2 TB, therefore you should configure HDD size limit in a service template to prevent HDD resizing larger than 2 TB. In case of GPT type, there is no such limitation.
    3. Cloud Infrastructure Automation supports virtual machines with only one HDD, otherwise you won't be able to register a VM OS template in the Cloud Infrastructure.
    4. To view what file systems are supported, refer to Virtuozzo documentation.

    Important: When partitioning your node's drives, keep in mind the following:
    1. Only the last partition of a disk can be resized. So if you know you will need to resize the /root partition in the future, configure this partition as the last one on the disk.
    2. LVM partitions cannot be resized; so make sure that the last partition is not an LVM partition.

  2. Copy the image of OS installation disk to virtualization node where you are going to create a VM OS template.
  3. Install an operating system in the virtual machine.
  4. Install Virtuozzo guest tools in the virtual machine (the VM should have the Internet access for downloading necessary packages during guest tools installation):

    1. Mount the iso image of Virtuozzo guest tools to the CD-ROM of the VM.

      # prlctl set VM_Name --device-add cdrom --image /usr/share/vz-guest-tools/vz-guest-tools-lin.iso
    2. Log in to the VM via SSH.
    3. Create a mount point for the optical drive with the guest tools image and run the installer:

      # mount -t iso9660 /dev/cdrom /mnt
      # cd /mnt
      # ./install

      For detailed information about Virtuozzo guest tools, refer to Virtuozzo User's Guide >> Managing Virtual Machines and Containers > Performing Initial Configuration of Virtual Machines and Containers > Installing VirtuozzoGuest Tools section.

  5. Create two virtual network cards for the virtual machine (optional step):

    • Create the first network card and configure it to operate in the host-routed mode:

      # prlctl set VM_Name --device-add net --type routed
    • Create the second network card and configure it to operate in the bridged mode:

      # prlctl set VM_Name --device-add net --network Bridged

      If the virtual machine already has a network card, you can change its networking mode by using the --device-set Net_Dev option instead of --device-add net (for example, --device-set eth0 to change the networking mode of the eth0 network card).

      Note: If you face issues with Plesk installation, it may be related to misconfiguration of network adapters in virtual machines. For more information, refer to https://kb.cloudblue.com/130906.

  6. Make sure that the network cards are configured not to use the DHCP protocol, and no network settings (IP addresses, gateways, and so on) are manually set for them.
  7. Make sure no disk images are attached to the virtual machine.
  8. Enable the memory hotplug functionality for the virtual machine:

    # prlctl set VM_Name --mem-hotplug on

    Note: Memory hotplugging allows to resize VM memory on the fly without a reboot. Be aware this feature is supported only for virtual machines with at least 1GB of RAM.

  9. Enable the CPU hotplug functionality for the virtual machine:

    # prlctl set VM_Name --cpu-hotplug on
  10. Enable automatic updates for Virtuozzo guest tools installed in the virtual machine:

    # prlctl set VM_Name --tools-autoupdate on
  11. In Linux virtual machines, Virtuozzo guest tools require Dynamic Kernel Modules Support (DKMS) that can be installed using the following command inside the virtual machine:

    # yum --enablerepo rpmforge install dkms
  12. Enable remote desktop access by doing the following:

    • In Linux virtual machines, allow SSH access for root user.
    • In Windows virtual machines, allow remote desktop access for administrator user.

Once the virtual machine is configured, you can use it to create an OS template with the same configuration.

Creating VM OS Template

Note: When preparing linux-based VM OS templates for Plesk in VPS offers, make sure that the "wget" utility is installed in the VM template. The wget is required to download Plesk installer during provisioning of Plesk in VPS.

To create an OS template, run this command on virtualization node:

# prlctl clone VM_Name --name Template_Name --template

VM_Name in this command above denotes the name of the virtual machine you prepared in Creating and Configuring Virtual Machine above, and Template_Name is the name to assign to the template.