Crash course: Virtualization with KVM on Ubuntu Server

Learn how to get KVM running on Ubuntu Server, install multiple guests, manage storage, and migrate guests to new hosts

1 2 3 4 Page 2
Page 2 of 4

Installing KVM

Install these packages:

$ sudo apt-get install qemu-kvm libvirt-bin virt-manager bridge-utils

Then run this command to make sure it's ready to run KVM:

$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

If anything is missing it will tell you KVM acceleration can not be used. Run it with root privileges to get some hints for making it work, like this:

$ sudo kvm-ok
[sudo] password for carla: 
INFO: /dev/kvm does not exist
HINT:   sudo modprobe kvm_intel
INFO: Your CPU supports KVM extensions
INFO: KVM (vmx) is disabled by your BIOS
HINT: Enter your BIOS setup and enable Virtualization Technology (VT),
      and then hard poweroff/poweron your system
KVM acceleration can NOT be used

Oops. Like I said, make sure it is enabled in your system BIOS. Now add your user to the libvirtd group, then logout and log back in to activate your group membership. Now you can control KVM without permissions hassles. Run this command to verify that KVM is running:

$ virsh -c qemu:///system list
 Id Name                 State

Perfect! The ID Name and State fields are empty, as they should be. Now start the Virtual Machine Manager and connect to your KVM server with this command:

$ virt-manager -c qemu:///system kvmhost

kvmhost is my server name, so you must replace it with your server name. You will be rewarded with something like Figure 1 below.

Figure 1: The graphical Virtual Machine Manager, successfully connected to the KVM server
1 2 3 4 Page 2
Page 2 of 4
ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon