KVM ( Kernel-based Virtual Machine ) is virtualisation software which is used for creating virtual machines on host system. In this post, we will share installation method of KVM on Ubuntu 14.04 LTS. We also include brief introduction of problem we have faced during installation and its solution we will also share.
We recommend you to read the official page of KVM.
Prerequisite
Because it is virtualisation software, it is very important to check below given requirement before installing the KVM on system.
1. Check processor supports virtualisation
Use the below given command, to make sure processor (CPU) supports virtualisation.
egrep -c '(vmx|svm)' /proc/cpuinfo
=> If output is 0 it means that your CPU doesn’t support hardware virtualization.
=> If output is 1 or more it support hardware virtualisation ( NOTE: virtualisation should be enabled in the system BIOS)
2. Check Operating System architecture
Use the any of the below given command to check Operating System’s architecture
arch
OR
uname -m
x86_64 represents 64 bit kernel.
i386, i486, i586 or i686 represents 32 bit kernel.
On 32-bit kernel install, we will be limited to 2GB RAM at maximum for a given VM.
32-bit kernel only host 32-bit guest kernel.Whereas 64-bit kernel can host both 32-bit and 64-bit guest O.S.
Follow installation steps of KVM on Ubuntu 14.04 LTS (Desktop)
Step 1 : Install KVM and other supportive packages
sudo apt-get install qemu-kvm libvirt-bin bridge-utils
Step 2 : Check the changes (For learning purpose)
Read the changes happened in /etc/group and /etc/passwd file.
Two group get created –
1. kvm
2. libvirtd (You can see user called sharad is part of this group. I login with this user and doing installation, hence by defualt it is part of this group)
sudo cat /etc/group
..
kvm:x:128:
libvirtd:x:129:sharad
Two new users get created. Both users have false login means it is required for KVM software.
1. libvirt-qemu
2. libvirt-dnsmasq
sudo cat /etc/passwd
..
libvirt-qemu:x:119:128:Libvirt Qemu,,,:/var/lib/libvirt:/bin/false
libvirt-dnsmasq:x:120:129:Libvirt Dnsmasq,,,:/var/lib/libvirt/dnsmasq:/bin/false
Step 3 : Verify KVM Installation
After installation of packages which we have done in Step 1. Run the below given command to verify KVM installation
virsh -c qemu:///system list
On first time we faced the error. Given below is details.
sharad@linuxworld:~$ virsh -c qemu:///system list
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
sharad@linuxworld:~$
Solution: For solving this, just relogin (logout – login back) with same user account into system.
Now run the same command once again. It should show below given output. It verifies, KVM installation is complete.
Step 4: Install Virt-Manager
To control and manage the KVM in our desktop, we will install virt-manager.
sudo apt-get install virt-manager
After installation get completed. To open the virt-manager simply run the below given command
virt-manager
On first time, we got the below given error while opening virt-manager
Solution is simple. Install the qemu system.
Close the opened Virt-Manager windows. And run the command –
sudo apt-get install qemu-system
Retry once again and open the virt-manager by using command
virt-manager
It should be opened without any problem.
Step 5 : Create first virtual machine
Before creating first virtual machine. stop/start libvirt-bin.
sudo stop libvirt-bin
sudo start libvirt-bin
Now you can create the Virtual machine , by opening virt-manager.
stop/start of libvirt-bin is solution of given below error
Unable to complete install:'unsupported configuration hda-duplex not supported in this Qemu binary'
At the time of creating our first VM, we got this error windows. Here is the reference
was not helpful at all
Thank you !! You’ve detailed it very well.
When I click for creating a new virtual machine in the Virtual Machine Manager it says:
Warning: KVM is not installed. …………………………. Your virtual machines may perform poorly.
I am facing the same problem here. Please update if you have solved the problem.
encountering 2 issues
1)a user account (Libvirt Qemu) is created and i am not able to open it because i dont have the password.
2)also when i click to create a new virtual machine it shows me a warning “KVM is not available………………………………. your virtual machines may perform poorly”
Perfecto.
Antes de éste post no había conseguido instalar y utilizar KVM.
Ahora funciona perfectamente.
Muchas gracias.
Perfect.
Before this post I couldn’t install and run KVM.
Now it run very well.
Thank you very much.
You are welcome Santiago!
Regards
Sharad