Create solusvm KVM templates Print

  • #solusvm kvm tempaltes
  • 3

Here are instructions to create Generation 1 and Generation 2 templates from a KVM VM.

Generation 1 template
Generation 1 templates are fixed size byte by byte images. Generation 1 templates should be used if it is required to create a special template that either includes obscure partitions or filesystems that cannot be manipulated from the host node. These include, but are not limited to, FreeBSD (Unix) or logical partitions. Generation 1 templates can have networking setup by SolusVM, however, any filesystem resizing should be scripted inside the template.

  1. Prepare a source VPS from which template will be created.

  2. Shutdown the server in Virtual Servers > the necessary VPS (note its VMID, for example, kvm101)

On the slave server where the VPS is hosted:

  1. Execute the following command to create a template:

    # /scripts/kvmtemplate --mode=package --vmid=kvm101 --generation=1

    once the script is finished, location of the created template will be displayed:

    # Template: /home/solusvm/kvm/template/template-149fee41d5801f96368c959a00dd6092a56ba031.gz

  2. Rename the template:

    # mv /home/solusvm/kvm/template/template-149fee41d5801f96368c959a00dd6092a56ba031.gz /home/solusvm/kvm/template/linux-centos-7-x86_64-custom-gen1-v1.gz

  3. Upload the created template to the Master server into the same template location:

    # /home/solusvm/kvm/template/linux-centos-7-x86_64-custom-gen1-v1.gz

  4. Add the template in SolusVM.


Generation 2 template
Generation 2 templates are far more flexible than generation 1 templates in respect to filesystem resizing and configuration. Generation 2 templates should be used if the template operating system will be Linux or Windows and will use standard filesystems (NTFS, ext3 or ext4). Generation 2 templates do not currently support logical volumes or extended partitions, generation 1 templates should be used for that.
Note: for Debian 9/Ubuntu 18 templates ext3 file system should be selected for the data partition. Otherwise, some feature will be not available on CentOS 6 host node.

  1. Prepare a source VPS from which template will be created.

  2. Shutdown the server in Virtual Servers > the necessary VPS (note its VMID, for example, kvm101)

  3. Find a partition for resizing (which will contain OS and other data) in the future template:

    # /scripts/kvmtemplate --mode=prescan --vmid=kvm101 --generation=2
    Name Type VFS Label MBR Size Parent UUID
    /dev/sda1 filesystem ext4 - - 20G - 23261380-2181-4fee-bf1a-b7235d2b9ad9
    /dev/sda2 filesystem swap - - 99M - d0bc2596-74ae-45b2-b2d4-d59f06b54d07
    /dev/sda1 partition - - 83 20G /dev/sda -
    /dev/sda2 partition - - 82 99M /dev/sda -
    /dev/sda device - - - 20G - -

    In the example above partition to resize it 1. The second partition will be used for SWAP.

  4. Prepare the source VPS for template creation by removing any SSH keys, mac addresses, and udev rules:

    Note: this procedure is not foolproof. VPS should be prepared manually to verify that all history is removed and configuration files are clean. Also /etc/fstab should be correct correct and any UUIDS are removed if this is a Linux virtual server. Use vda for virtio and sda for ide.

    Warning: this step is not required for a Windows template.

    # /scripts/kvmtemplate --mode=prepare --vmid=kvm101 --generation=2

  5. Create the template:

    # /scripts/kvmtemplate --mode=package --vmid=kvm101 --generation=2

    the output of the command will contain the location of the created template:

    # Template: /home/solusvm/kvm/template/template-149fee41d5801f96368c959a00dd6092a56ba031.gz

  6. Rename the template:

    # mv /home/solusvm/kvm/template/template-149fee41d5801f96368c959a00dd6092a56ba031.gz /home/solusvm/kvm/template/linux-centos-5.8-x86_64-custom-gen2-v1.gz

  7. Upload the created template to the Master server into the same template location:

    # /home/solusvm/kvm/template/linux-centos-5.8-x86_64-custom-gen2-v1.gz

  8. Add the template in SolusVM.


Additional notes for Windows templates:

Most versions of Windows Server require an administrator password to be set on the first login. This can make the creation of a template containing a datacenter license key difficult because of the necessity of the first login. Set a default administrator password and specify it in the Default root/admin password box when adding the template to SolusVM.
There are also other tools described on the Internet to prepare a Windows installation for cloning. For more information, you can search for "Windows sysprep".

Here is the related documentation for this.

https://documentation.solusvm.com/display/DOCS/Create+KVM+Templates



Was this answer helpful?

« Back

Powered by WHMCompleteSolution