Installing VirtualBox is getting increasingly painful on Ubuntu due to the problems with UEFI Secure Boot and the VirtualBox kernel modules. Another reason for an alternative is that running VirtualBox VM’s completely in the background is not as straightforward as it could be.
From the available alternatives I looked into (VMWare, Xen & KVM) it was KVM that fitted my needs (casual VM usage with mostly headless VM’s for testing purposes). Main reasons:
- Well supported by Ubuntu
- Easy, straightforward install
- Background VM’s are simple as
- Moving VM’s from one host to another is a breeze
To check if the CPU can actually support
egrep -c '(svm|vmx)' /proc/cpuinfo
If the number returned is > 0 your systems should be capable to run.
You will also enable your BIOS for virtualisation (in Security settings of most BIOS’s) if that has not already be done. You will get an error if not enabled if you are trying to run an install. The Install of KVM will work fine.
sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
sudo addgroup libvirtd
sudo adduser libvirtd
sudo service libvirtd start
sudo service libvirtd status
Moving VM’s to another host
virsh shutdown VMNAME
virsh dumpxml VMNAME > /tmp/VMNAME.xml
scp /tmp/VMNAME.xml TARGETHOST:/tmp/VMNAME.xml
scp /var/lib/libvirt/images/VMNAME.qcow2 TARGETHOST:/var/lib/libvirt/images/VMNAME.qcow2
virsh define /tmp/vm.xml
virsh start vm
Once you have confirmed operation you probably want to remove the source VM from the Source Host.
virsh undefine VMNAME
This Post Has One Comment
I followed the same steps as mentioned above, but I am unable to ssh or find IP address of the VM but I see the VM running on the target host.