Bobcares

wesupport

CLIENT AREACall Us 1-800-383-5193
Bobcares

wesupport

Call Us 1-800-383-5193
Bobcares

wesupport

Call Us 1-800-383-5193

Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Create a custom Linux SolusVM KVM template

by | Jul 21, 2021

Wondering how to create a custom Linux SolusVM KVM template? We can help you.

Here at Bobcares, we often handle requests from our customers to fix similar KVM queries.

Today we will see how our support engineers fix this for our customers as a part of our Server Management Services.

 

How to create a custom Linux SolusVM KVM template?

Today, let us see the steps followed by our Support Techs to create a custom Linux SolusVM KVM template.

Before you proceed, remove all user accounts and their home directories from source VPS. In Linux systems there are system accounts and user accounts.

By default user account have UID from 1000 to 65534.

All users are listed in the file /etc/passwd in format:

USERNAME:x:UID:GID:description:HOMEDIR:SHELL

To remove user use the following command:

deluser –remove-all-files USERNAME

Then, remove all SSH keys from the source VPS.

For generation 1 templates run the following command on source VPS:

rm /etc/ssh/ssh_host_*

Generation 1 template

Generation 1 templates are fixed-size byte by byte images.

You can use it if  it is required to create a special template that either includes obscure partitions or filesystems that cannot manipulate from the host node.

Generation 1 templates can have networking setup by SolusVM, however, any filesystem resizing should script inside the template.

1.Firstly, prepare a source VPS from which template will be created.

2.Then, shutdown the server in SolusVM > Virtual Servers > the necessary VPS

3.Execute the following command to create a template:

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

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

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

4.Rename the template:

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

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

6.Add the template in SolusVM.

 

How to add Template in SolusVM?

1. Firstly, connect to the Master SolusVM server via SSH
2. Then, upload KVM template to the /home/solusvm/kvm/template/ directory. SolusVM provides its own pre-created KVM templates from TDN storage
3. After that log into SolusVM web interface and browse to Dashboard > Media > Add KVM Template
4. Then, configure the template per its requirements
5. Next, click on Add Template button.
6. Browse to Media > Media Sync > Create page
7. Sync templates between Master and Slave nodes
Click on Create Sync Job button
8. On the Jobs tab verify that the task is complete. It is possible to trigger this operation manually via Manually Force Sync button.

Master node:

# ls -lh /home/solusvm/kvm/template/windows-2012-server-trial-x86_64-gen2-v1.gz
-rw-r–r– 1 root root 0 Nov 22 23:29 /home/solusvm/kvm/template/windows-2012-server-trial-x86_64-gen2-v1.gz

Slave node:

# ls -lh /home/solusvm/kvm/template/windows-2012-server-trial-x86_64-gen2-v1.gz
-rw-r–r– 1 qemu qemu 3.7G Sep 12 2012 /home/solusvm/kvm/template/windows-2012-server-trial-x86_64-gen2-v1.gz

 

Generation 2 template

Usually, generation 2 templates are far more flexible than generation 1 templates with respect to filesystem resizing and configuration. Generation 2 templates should be used if the template will use standard filesystems ( ext3 or ext4).

Generation 2 templates do not currently support logical volumes or extended partitions, generation 1 templates should be used for that.

1. Firstly, prepare a source VPS from which template will be created.
2. Then, shutdown the server in SolusVM > Virtual Servers > the necessary VPS
3. Check partition table in the source VPS kvm123 to determine which partition should be resizable in the future – the necessary partition contains OS of the VPS/template:

# /scripts/kvmtemplate –mode=prescan –vmid=kvm123 –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 most cases, the partition to resize is the biggest partition. In the example above the biggest partition is /dev/sda1, so the partition to resize will be 1. Partition /dev/sd2 is SWAP.
4. Prepare the source VPS for template creation by removing any SSH keys, mac addresses, and udev rules:

# /scripts/kvmtemplate –mode=prepare –vmid=kvm123 –generation=2

5. Create the template:

# /scripts/kvmtemplate –mode=package –vmid=kvm123 –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-6-x86_64-custom-gen2-v1.gz

template name has to start with “linux”, as in the example above – “linux-centos-6-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-6-x86_64-custom-gen2-v1.gz

8. Add the template in SolusVM.

 

[Need assistance with SolusVM issues? We can help you]

Conclusion

In short, we saw how our Support Engineers create a custom Linux SolusVM KVM template

 

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags