Install KVM (Kernel Based Virtual Machine) On Ubuntu Server 14.04 / 14.10

KVM stands for Kernel Based Virtual Machine, it is a Kernel based virtualization software available in Linux like operating system. KVM is used to create and manage virtual machines and it works only if the CPU has a support of hardware Virtualization.

Use the below command to check whether your system’s CPU support hardware virtualization.

linuxtechi@localhost:~$ sudo egrep "svm|vmx" /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt lahf_lm arat dtherm tpr_shadow vnmi flexpriority ept vpid
...............................................

If you get output like above , then we can say that KVM will work on your system.

Note: vmx shows Intel processors and svm shows AMD processors. If the VT(Virtualization Technology) option is not enabled , then reboot the machine go to BIOS settings and enable it.

In this post we will discuss how to install KVM on Ubuntu Server 14.04 LTS & 14.10.

Installation Steps of KVM :

Step:1 Install the KVM & other required packages.

linuxtechi@localhost:~$ sudo apt-get install qemu-kvm qemu virt-manager virt-viewer libvirt-bin bridge-utils

Step:2 Set up bridging for networking.

Bridging is required if you want to access your virtual machines outside the host’s (hypervisor) network.

Edit the network file

linuxtechi@localhost:~$ sudo vi /etc/network/interfaces

# Network interfaces file 
auto lo
iface lo inet loopback

# eth0 interface
auto eth0
iface eth0 inet manual

# br0 interface 
auto br0
iface br0 inet static
address 192.168.1.190
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 4.2.2.2
bridge_ports eth0
bridge_stp off

Save & exit the file. You can change the network settings according to your setup.

Now reboot the machine.

Step:3 Check the bridge interface

linuxtechi@localhost:~$ ifconfig br0
br0       Link encap:Ethernet  HWaddr f0:4d:a2:6e:42:00  
          inet addr:192.168.1.190  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::f24d:a2ff:fe6e:4200/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:293 errors:0 dropped:0 overruns:0 frame:0
          TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:38443 (38.4 KB)  TX bytes:10988 (10.9 KB)

Step:4 Start the virt-manager

Open the terminal type the virt-manager command.

linuxtechi@localhost:~$ sudo virt-manager

kvm-first-time

Now create a new virtual machine , specify the name of the VM

virtual-machine-name

Click on ‘Forward

Specify the ISO image Location , OS Type and its version.

vm-iso-file

Click on Forward.

Specify Memory & CPU for the VM and then click on Forward

memory-cpu-vm

Specify the Disk storage for Virtual Machine , in my case i have allocated 30 GB space. By default Virtual machine images are created under “/var/lib/libvirt/images”. If this location does not have enough free space , then you can change storage location by selecting “Select Managed or other existing storage

virtual-machine-storage

Click on “Forward“.

Click on finish , to start creating the Virtual Machine.

bridge-virtual-machine

Once the Creation and installation of Virtual machine is finished , We can manage the Virtual machine using virt-manager.

manage-vm-virt-manager

Basic installation of KVM is completed, now enjoy KVM and have fun 🙂

1 thought on “Install KVM (Kernel Based Virtual Machine) On Ubuntu Server 14.04 / 14.10”

  1. Installing gui desktop environtment is prohibited on ubuntu server edition? There is nothing wrong with title, unless it’s says install kvm headless on ubuntu server

Leave a Comment

Your email address will not be published. Required fields are marked *