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.
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
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 –
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.
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.
[email protected]:~$ 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 [email protected]:~$
Solution: For solving this, just relogin (logout – login back) with same user account into system.
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
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
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'