How To Setup Virtualisation With KVM On A CentOS (SolusVM Slave)

Status
Not open for further replies.

Bharat

Active Member
1,973
2010
840
240
At our first attempt we faced some issues while setting up KVM node so i decided to make a step by step tutorial about this so that others can get things correctly.

Test Node Specification:
Intel E3-1230
1 TB SATA II (Will be used for OS and configurations files)
4 TB SATA II (Will be used for VPS Data)
16 GB RAM DDR3

How i configured my disk on installation:

Code:
[B]Disk 1[/B]
/boot      = 2048 M
/SWAP    = 32GB
/            = 100GB
/home    = Remaining

Disk 2 - This one left unformatted as it's 4TB so parted is needed to format that disk.


Video Presentation for below steps:
[video=youtube;6wkEBzZLljo]https://www.youtube.com/watch?v=6wkEBzZLljo[/video]


Part 1 – Disk Setup


Fdisk is the most commonly used command to check the partitions on a disk. The fdisk command can display the partitions and details like file system type. However it does not report the size of each partitions.


Code:
[FONT=trebuchet ms]$ sudo fdisk -l[/FONT]



You cannot create a Linux partition larger than 2 TB using the fdisk command. The fdisk won’t create partitions larger than 2 TB. For example, you cannot create 4TB partition size using the fdisk command. It will not allow you to create a partition that is greater than 2TB.

Creating 4 TB Partition Size


To create a partition start GNU parted as follows:
(Assuming your disk 2 is /dev/sdb)



Code:
[FONT=trebuchet ms]$ parted /dev/sdb[/FONT]



Creates a new Partition Table:


Code:
[FONT=trebuchet ms]$ (parted) mklabel gpt[/FONT]



Next, set the default unit to TB, enter:


Code:
[FONT=trebuchet ms]$ (parted) unit TB[/FONT]



To create a 4 TB partition size, enter:


Code:
[FONT=trebuchet ms]$ (parted) mkpart primary 0.00TB 4.00TB[/FONT]



To print the current partitions, enter:


Code:
[FONT=trebuchet ms]$ (parted) print[/FONT]



Quit and save the changes, enter:


Code:
[FONT=trebuchet ms]$ (parted) quit[/FONT]


Use the mkfs.ext4 command to format the file system: (Optionally You can use mkfs.ext3 if needed)


Code:
[FONT=trebuchet ms]$ mkfs.ext4 /dev/sdb1[/FONT]


Create the PV through following command:


Code:
[FONT=trebuchet ms]$ pvcreate /dev/sdb1[/FONT]



You can check that new PV through this command:


Code:
[FONT=trebuchet ms]$ pvscan[/FONT]



Create the Volume Group:


Code:
[FONT=trebuchet ms]$ vgcreate -s 32M vg1 /dev/sdb1[/FONT]



You can check that new volume group through this command:


Code:
[FONT=trebuchet ms]$ vgdisplay[/FONT]







Part 2 – Network Setup (Source)


Bridging requires the bridge-utils package to be installed on the server. To check if it’s installed, do the following:


Code:
[FONT=trebuchet ms]$ rpm -q bridge-utils[/FONT]



If you get an output – it’s installed, if not, it needs installing:


Code:
[FONT=trebuchet ms]$ yum install bridge-utils -y[/FONT]



Before setting up your bridge, the contents of /etc/sysconfig/network-scripts/ifcfg-eth0 will look like the following:


Code:
[FONT=trebuchet ms]DEVICE=eth0
BOOTPROTO=static
BROADCAST=102.100.152.255
HWADDR=00:27:0E:09:0C:B2
IPADDR=102.100.152.2
IPV6INIT=yes
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
NETWORK=102.100.152.0
ONBOOT=yes

[/FONT]
To back up your current ifcfg-eth0 before modification:


1. Run the following command:


Code:
[FONT=trebuchet ms]$ cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/backup-ifcfg-eth0

[/FONT]
2.Create the bridge file:


Code:
[FONT=trebuchet ms]$ nano -w /etc/sysconfig/network-scripts/ifcfg-br0[/FONT]



3. Copy parts of ifcfg-eth0 to it:


Code:
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
BROADCAST=102.100.152.255
IPADDR=102.100.152.2
NETMASK=255.255.255.0
NETWORK=102.100.152.0
ONBOOT=yes


4. Save that file and edit ifcfg-eth0:


Code:
[FONT=trebuchet ms]$ nano -w /etc/sysconfig/network-scripts/ifcfg-eth0[/FONT]



5. Remove the networking parts and specify the bridge:


Code:
DEVICE=eth0
HWADDR=00:27:0E:09:0C:B2
IPV6INIT=yes
IPV6_AUTOCONF=yes
ONBOOT=yes
BRIDGE=br0


6. Bridge is set up. Make sure that the changes are correct and restart the networking:


Code:
[FONT=trebuchet ms]$ /etc/init.d/network restart[/FONT]



7. Once it’s restarted you see the new bridge using the ifconfig command:


Code:
[FONT=trebuchet ms][root@bharat ~]# ifconfig
br0       Link encap:Ethernet  HWaddr 00:27:0E:09:0C:B2
inet addr:102.100.152.2  Bcast:102.100.152.255  Mask:255.255.255.0
inet6 addr: fe80::227:eff:fe09:cb2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:48 errors:0 dropped:0 overruns:0 frame:0
TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2984 (2.9 KiB)  TX bytes:13154 (12.8 KiB)[/FONT]
Code:
[FONT=trebuchet ms]
eth0      Link encap:Ethernet  HWaddr 00:27:0E:09:0C:B2
inet6 addr: fe80::227:eff:fe09:cb2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:31613 errors:0 dropped:0 overruns:0 frame:0
TX packets:9564 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:2981335 (2.8 MiB)  TX bytes:2880868 (2.7 MiB)
Memory:d0700000-d0720000[/FONT]
Part 3 – Installing a SolusVM KVM Slave: (Source)


In SSH as root do the following:


Code:
[FONT=trebuchet ms]$ wget http://soluslabs.com/installers/solusvm/install[/FONT]



Code:
[FONT=trebuchet ms]$ chmod 755 install[/FONT]



Code:
[FONT=trebuchet ms]$ ./install[/FONT]



Now, follow the steps as shown in Video.


The install will now do it’s work.You will get next output (output text may vary)


Once the installer is complete you will be presented with the slave keys and any further instructions for your install type.

Please use below ID key & ID password to add it into the solusvm with LV Group as vg1 (As shown above)

Code:
ID Key .......... : XIXXXXXXXXElCXXXXXbdc6L7XXXqPnpAk2FNLBLwxFEnMpj9ac  jdH
ID Password ..... : JA5yPbYb3NLtES5XXXXXXXgiXXXXXawR5Y7x4YvoLJGq5u


FAQ:

1. I have installed the above setup as shown but still VPS shows offline status.
A: There might be the multiple reasons for this problem but in our case it was "Internal Error No Supported Architecture"

Code:
[root@kvm1 ~]# virsh create /home/kvm/kvm101/kvm101.xml
error: Failed to create domain from /home/kvm/kvm101/kvm101.xml
error: internal error no supported architecture for os type 'hvm'
=================================================

When we facing the above error, we should enable the VT support in the BIOS. Please do contact your DC for enable this.

2. I have one Master Node (No Virtualisation) and one KVM Slave Node. I have setup KVM Slave according to the tutorials but still i'm unable to add my slave node in my master?
A: Pease run the below command on the node and re-add the node this should do the trick.

Code:
[FONT=trebuchet ms]
rm -rf /usr/local/solusvm/data/allow.dat[/FONT]


3. I created a VPS but it's not booting up?

A: Please can you attempt to start this VPS Manually, you can do so by running the following command on the server that hosts this VPS in SSH:

Code:
virsh create /home/kvm/kvmID/kvmID.xml

You will obviously need to replace kvmID with the actual kvmID of the VPS, you can find this in SolusVM in the Virtual Server List Table under VMID or by going to the VPS's Management Area and in the 'Information' table under ID.

4. I created a VPS but it's not booting up even after trying to boot it manually as in step 3

A: Please enable cpu module like below and have a try

Code:
modprobe kvm-intel

5. While running the command in step 4 gives me FATAL: Error inserting kvm_intel error, what should i do?

Please can you reinstall the OS (Centos 6 64Bit) on the node then have a try on it further, if still you are getting errors while booting up the server then you have to enable VT (virtualization) on your BIOS and processor. Please contact your DC and enable it.


I hope this guide will help others like me setting up KVM node swiftly and easily :)

Regards
Bharat
 
2 comments
Status
Not open for further replies.
Back
Top