Clone VPS instances in a few clicks – that’s where SolusVM templates helps VPS hosting providers. SolusVM facilitates easy VM creation using these KVM templates.
VPS instances can run Linux and Windows OS in them. Depending on the OS version, the template used will vary.
Today, we’ll see how to generate KVM templates for your SolusVM VPS instances.
How to create SolusVM templates
There are three ways to create these templates, depending on the requirements of the VPS instances to be created.
1. Creating templates with SolusVM tools
SolusVM KVM templates can be created in slave server using the script ‘/scripts/kvmtemplate’. Templates can be created from existing VPS instances, using this tool.
However, this is not a one-step tool. The VPS node has to be scanned and prepared for the template generation. The partition and the file system should be verified before generating template.
The steps performed include:
i) Prescan – The partition number and file system for the VM is identified using this step
/scripts/kvmtemplate --mode=prescan --vmid=vm1 --generation=2
ii) Prepare – This step involves removing SSH keys, mac addresses and udev rules. The other data such as history, UUIDs and configuration files are manually removed and fstab entries are verified.
/scripts/kvmtemplate --mode=prepare --vmid=vm1 --generation=2
iii) Package – After confirming that the VM is ready for template creation, we execute the package scripts in it. This will generate a template out of it.
/scripts/kvmtemplate --mode=package --vmid=vm1 --generation=2
iv) Naming – The template that is generated in the folder ‘ /home/solusvm/kvm/template/ ‘ is then renamed with appropriate label for identification.
2. Downloading templates manually
SolusVM provides a set of Linux and Windows OS templates that can be downloaded and used by VPS providers to create their instances.
To use the OS templates provided by SolusVM, there required templates are downloaded from the repository. The OS files are upload to /home/solusvm/kvm/template folder on the master server.
For using these downloaded templates for VPS creation, these OS templates should be made available in the SolusVM Admin panel.
This is done by accessing the SolusVM Admin panel, from the section ‘Media -> Add KVM Template -> Enter details’ and Save.
However, the template that is downloaded is only available in the SolusVM master now. For the slave nodes to use these templates, they have to be copied over to other nodes too.
To sync the VPS templates to nodes, the option ‘Media > Media Sync’ is used. A sync job is created after selecting the template and the servers to sync. The sync job is then force started and templates get copied over.
3. Creating custom templates
The default template downloaded from SolusVM repository may not be suitable for direct use in VM creation. The VPS node has to be partitioned, server software installed and network configuration has to be done.
Doing this every time when a VPS is created, is cumbersome. In such scenarios, we create custom SolusVM templates with required software and other configuration.
For creating custom templates, the first step is to install OS in the VM with minimal disk partitioning and network configuration. The VM ID and associated logical volume group name is noted down.
Source VM is then configured with required server software and other tweaks. After that, it is shut down and prepared for template creation.
We then mount the partition of the VM in the host node and edit the fstab files as suited. After confirming that the entries are properly added, history is removed.
The virtual server is now unmounted after adding proper network parameters and existing disk mappings are removed. Now, the final step is creating the template and labeling it.
Conclusion
In short, SolusVM templates enable VPS hosting providers to quickly provision VPS instances for their customers. But caution has to be exercised as any mistake that can lead to template errors. Today, we saw the 3 different ways Support Engineers use for creating and configuring OS templates.
0 Comments