You are here
KVM install on Ubuntu 9.10
How to install KVM (Kernel Virtual Machine) on Ubuntu 9.10 (Karmic Koala), 64 bit edition (x86_64).
We implement here the virtualisation philosophy of Ubuntu: we use KVM as backend virtualisation technology, libvirt as its toolkit/API, and the frontends for managing VMs include will be virt-manager (GUI) and virsh (CLI). Two hints before we start.
First, to be able to run KVM, you need a processor that supports virtualisation (INTEL-VT from Intel, or AMD-V from AMD). To check what you have, run the following command:
egrep '(vmx|svm)' --color=always /proc/cpuinfo;
If there is an output, it means that your CPU does support hardware virtualisation. Additionally, you still need to make sure that virtualisation is enabled in the BIOS.
Second, use a 64 bit kernel if possible. With 64 bit, you can server more RAM for the VMs. And a 64 bit system can host both 32 bit and 64 bit guests. A 32 bit system can only host 32 bit guests. To check whether your processor is capable for 64 bit, run the following command:
grep ' lm ' /proc/cpuinfo
If there is an output, it means that your CPU does support 64 bit (lm stands for Long Mode, so indicates an 64 bit CPU).
If everything is fine so far, then start to install. We are going to install two meta packages: ubuntu-virt-server and ubuntu-virt-mgmt.
- ubuntu-virt-server installs the packages needed to setup a base virtulization host (kvm, libvirt-bin and openssh-server)
- ubuntu-virt-mgmt installs what you need to administer: some CLIs and GUIs (virt-manager, virt-viewer, virt-clone, virt-image, virt-install, python-vm-builder).
To install, open a terminal and:
sudo apt-get install ubuntu-virt-server ubuntu-virt-mgmt
Make sure you are also a member of the libvirtd and kvm groups. In Ubuntu 9.10 the libvirt-bin package will automatically add members of the admin group to the libvirtd group. For KVM, run:
sudo adduser $USER kvm
But you still need to log out, and log back in for this change to take effect. To test, start virsh in a terminal:
virsh
It should list something like this:
$ virsh -c qemu:///system list
Id Name State
----------------------------------
$
The next step is to enable a network bridge between the host and the virtual machines. With bridge, the VMs can access the outside world, and external hosts can directly access services on virtual machines. For this, a bridge needs to be configured. This allows the virtual machines to connect to outside network through the physical interface of the host. To setup a bridge interface, edit /etc/network/interfaces and change the existing config like this, but use the values for your network:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.0.10
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
And you have to restart the network, as well.
sudo /etc/init.d/networking restart
To check the bridge, type
sudo brctl show
The result should be:
bridge name bridge id STP enabled interfaces
br0 8000.00248c145ba5 no eth0
virbr0 8000.000000000000 yes
There is no need in Ubuntu 9.10 to remove/uninstal the NetworkManager, as you can find in some how-to for older versions. Just setup eth0 to manual:
"iface eth0 inet manual".
So, that's it. Start the Virtual Manager from your menu, and install your first VM.
Comments
'sudo adduser $USER kvm' really needed?
Is it really needed to add a user to the group kvm? In the Ubuntu KVM Install Howto
https://help.ubuntu.com/community/KVM/Installation#Adding%20Users they note:
there is no need to add yourself to the kvm group
- Markus
Apparently you do need to add
Apparently you do need to add yourself to the kvm group or SSH won't connect, at the very least.
BTW.. KVM is lightning fast!