How To Add Solus Vm Templates
Lately, I have been working with a lot of customised virtual machines based mostly on the KVM/XEN applied science. The one really popular and easy to manage is from company SolusVM (recently purchased by OnApp) http://solusvm.com/. The about of the commercial hosting companies are using it nowadays. If you are deploying Chief/Slave solution which KVM requires, you will find default templates on the following page here: https://tdn.solusvm.com/. But what if we want to create our own, custom KVM template with pre-installed software/configuration. In this article, I will draw how you can create your own custom KVM template designed for the SolusVM virtualization software.
1) Download and boot CentOS 6 or 7 minimal iso files and upload to the /home/solusvm/kvm/iso folder on the Primary SolusVM server.
2) In SolusVM Dashboard become to Media --> Add ISO fill up in all details, leaving PAE as 'off'
iii) Go back to the Media department and click on the 'Media Sync' choice. Select 'CREATE', scroll down to the lesser of the page and in the ISOS section select ISO files, on the left side you wish to synchronise and the nodes on the right side where files volition be copied.
You volition then see:
Successful! Sync job added
Yous can go back, click on 'Media Sync' again and check the status of the synchronisation. Alternatively, you tin log in to the KVM Slave node, and watch the roll process. It will show as something similar this:
curl -vvv --stderr /usr/local/solusvm/tmp/bc3x3ea4e26e5xe1af1408321416x956113a46x58763.log --insecure https://x.x.x.ten:5656/9bxebcaxf01d29abf5xa6x39fc3ca6199ce7d9c7d2fd/CentOS-seven-x86_64-Minimal-1611.iso -o /abode/solusvm/xen/iso/CentOS-7-x86_64-Minimal-1611.iso
Annotation: Make sure that the primary partition on the KVM Slave Hypervisors has enough space to store both ISO and fresh template data. By default that partition is 60Gb, only delight cheque before pushing anything, to brand sure.
iv) Go to 'Virtual server' tab --> Select 'Add together new Server' and select KVM.
5) Leave the 'Template' tab set to
Click 'ADD'. On the adjacent screen, yous will be prompted to enter the VNC password, port number and IP address, but you can ignore that since you lot will finish the installation from within the main SolusVM dashboard which is already authenticated.
vi) Go dorsum to 'Virtual Servers' --> 'List servers' and click on VNC to load the installation screen. Chrome seems to have some difficulties, so you can use Firefox, which works perfectly.
7) Select 'Language' and keep. On the config screen, you tin can configure things like Date/Timezone, Keyboard, Security policies, simply the nearly of import part hither is to click on the INSTALLATION DESTINATION and cheque "I WILL CONFIGURE PARTITIONING". The reason for this is because if you leave it on the automatic option, it will configure LVM instead of IDE, and we need IDE partitioning and so that afterward the /scripts/kvmtemplate script can configure the SolusVM template properly.
Adjacent you lot will be prompted with a "+" push down and so you can start manually creating partitions. In my case, I want every custom cPanel installation to accept 11GB for the "/" Root sectionalisation and 2GB for SWAP. You may adjust this, since the template volition be Generation 2 anyway which gives the option to resize the partition for new virtual servers. This step is but to avoid LVM at all costs.
8) Click on the 'NETWORK & HOSTNAME' selection and enable it by selecting 'ON'.
9) While the installation is running, you lot tin can ready your Root countersign and create additional users (if needed). When SolusVM KVM template is created, the password volition exist changed to something random.
10) When the OS installation complete, click 'REBOOT' and if everything is fine, you lot should get to the CentOS 7 login.
xi) Login as root and type your previously chosen countersign. Occasionally the network adapter is not properly added, and then if when you type:
ip addr show
You see something like:
Get back to the SolusVM Dashboard and click 'Re-Configure' at the top of the page. Please wait for the system to end. Y'all volition run across on your screen. Virtual Server Re-Configured! System Files Changed:
/etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/road-eth0 /etc/resolv.conf /etc/hosts
ninety% of the time afterwards that yous will be able to bring the IP address up and continue work from your local computer terminal. If not, log back into the VNC console and get to the /etc/sysconfig/network-scripts binder, and re-create ifcfg-ens3 to ifcfg-ens3.bak so cp ifcfg-eth0 to efcfg-ens3. Click on 'reboot' from the VNC console, go back and type:
ip addr show
To see if the address is assigned properly. E'er ping a site, I often exercise google.rs or google.com, which are safety.
12) Log in as root from your local figurer using SSH, port 22.
13) blazon yum update to update the kernel and software to the latest version.
14) type reboot
fifteen) Make adjustments on the server and type halt to power off the server.
16) On the KVM Slave node where this instance is settled type:
/scripts/kvmtemplate --mode=prescan --vmid=kvm108 --generation=ii
- Where kvm108 is real the KVM ID your server is using.
Output volition be similar to this:
Name Type VFS Label MBR Size Parent UUID /dev/sda1 filesystem ext4 - - 11G - 7cad89f1-23d6-4a74-aa98-926c4626a6f9 /dev/sda2 filesystem swap - - 2.0G - 3c13d689-bca8-4709-8ace-28a53fce7e96 /dev/sda1 partition - - 83 11G /dev/sda - /dev/sda2 partition - - 82 2.0G /dev/sda - /dev/sda device - - - 13G - -
From this, we now know that the chief division is using /dev/sda1 and that Bandy must use /dev/sda2
Notation: This is very important because when you create the KVM Template from within the SolusVM dashboard you need to enter the proper partitioning number for the Resizable and Bandy division. If you lot use QEMU-KVM (or virt-manager GUI) for running your virtual machines, you can specify a disk commuter to be used for accessing the machine'southward disk image. By default, IDE is selected, but VirtIO is a very popular pick as well. From my feel, VirtIO is giving meliorate performance, only IDE is more stable, but this is my personal opinion, you may switch to the VirtIO during the CentOS vii installation procedure.
17) On the host node y'all will need to mountain the virtual server's partitions:
kpartx -a /dev/VOLUME_GROUP/KVMID_img mount /dev/mapper/VOLUME_GROUP-KVMID_img1 /mnt
In my example that was:
kpartx -a /dev/system/kvm108img
mount /dev/mapper/system-kvm108img1 /mnt
(you lot find that we mounted _kvm1, well that is partitioning 1 or the space reserved for Root system)
18) Jump to the /mnt/etc binder and edit fstab file. The file will look like:
# # /etc/fstab # Created past anaconda on Lord's day May seven 13:24:nineteen 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See homo pages fstab(5), findfs(8), mount(8) and/or blkid(eight) for more info # UUID=7cad89f1-23d6-4a74-aa98-926c4626a6f9 / ext4 defaults 1 1 UUID=3c13d689-bca8-4709-8ace-28a53fce7e96 bandy swap defaults 0 0
You need to adjust it to:
/dev/sda1 / ext4 defaults one 1 /dev/sda2 swap swap defaults 0 0
19) Save file and so, let's remove fustigate history:
rm -f /mnt/root/.bash_history
20) Some distros need the post-obit to become networking working (CentOS6 and older Debian versions):
rm /mnt/etc/udev/rules.d/70-persistent-cyberspace.rules touch /mnt/etc/udev/rules.d/70-persistent-net.rules chattr +i /mnt/etc/udev/rules.d/70-persistent-net.rules
21) Unmount the virtual server:
cd ~ umount /mnt
22) Remove the mappings:
kpartx -d /dev/VOLUME_GROUP/KVMID_img
In my case:
kpartx -d /dev/system/kvm108_img
23) Now, everything is ready for the KVM template to be created:
/scripts/kvmtemplate --mode=set up --vmid=kvm108 --generation=two
Once the source virtual server is ready to be packaged yous but run the package scripts. Example:
/scripts/kvmtemplate --manner=bundle --vmid=kvm101 --generation=two
It may accept a while for it to complete. Once it's done you lot volition exist given a location and file proper noun for the template. Example, in my case, is:
Copy to destination and make sparse ... Sparsify operation completed with no errors. Before deleting the quondam deejay, carefully check that the target disk boots and works correctly. Creating template. Please await... Template: /home/solusvm/kvm/template/template-3fa91718ef6628e568a4eb4eba7c2f083c888f3e.gz
The next step is to rename the template. Example:
cd /domicile/solusvm/kvm/template/ mv template-3fa91718ef6628e568a4eb4eba7c2f083c888f3e.gz linux-centos-seven-x86_64-custom-gen2-v1.gz
or if it was a Windows template:
cd /home/solusvm/kvm/template/ mv template-149fee41d5801f96368c959a00dd6092a56ba031.gz windows-2008-server-r2-custom-x86_64-gen2-v1.gz
Note: It is really important to delegate name of the template properly. You may freely follow my example naming it every bit custom-gen2, custom1-gen2... etc and then add together proper descriptions within the SolusVM Main dashboard. I have tried making custom names, and that never worked.
rsync gz archive and send it to the SolusVM Master node nether the /home/solusvm/kvm/template/ binder.
Notation: Remove it on the current node after the archive is sent to the Master node. It volition render dorsum naturally when Media Sync is pushed.
Finally, make sure when adding the template to SolusVM you lot specify the correct generation and segmentation to resize. Go back to the Media section and click on the 'Media Sync' option. Select CREATE, scroll down to the bottom where KVM Templates are stored and select a new template on the left side and the nodes on the correct side where information technology needs to be copied (synchronised) -- (See Step 3. in this document)
24) Wait again for the new template to get synced on the nodes. Afterwards that pace, you lot can go to the Virtual Servers department and provision your first server with customised KVM template prepared for the SolusVM software.
I hope this commodity will be helpful to anyone who wish to automate the vps deployment process and utilise QCOW2/KVM environment. I am starting soon http://vmtemplates.com website where I plan with actually minor corporeality to deploy many set made templates for all blazon of virtual machines.
Skillful luck!
How To Add Solus Vm Templates,
Source: https://nemanja.io/how-to-create-custom-kvm-template-for-solusvm/
Posted by: robbinsangleatild.blogspot.com
0 Response to "How To Add Solus Vm Templates"
Post a Comment