General

Installation

Install packages:

$ sudo apt-get install kvm libvirt-bin ubuntu-vm-builder virt-manager virt-viewer

Add yourself to kvm groups:

$ sudo adduser `id -un` libvirtd
$ sudo adduser `id -un` kvm

Test installation with:

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

$

Creating a network bridge on the host

edit /etc/network/interfaces. Add bridged interface with dhcp:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

auto br0
iface br0 inet dhcp
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off

Restart networking:

$ sudo /etc/init.d/networking restart

Edit /usr/share/ubuntu-vm-builder/templates/libvirt.tmpl to use the bridge interface:


      
      

Create VM with Ubuntu-vm-builder

See: * https://help.ubuntu.com/community/KVM * http://doc.ubuntu.com/ubuntu/serverguide/C/ubuntu-vm-builder.html

Install package:

sudo apt-get install ubuntu-vm-builder

Create VM with (Jeos) with default settings:

sudo ubuntu-vm-builder kvm hardy --addpkg vim --arch i386 --mem 512 --libvirt qemu:///system

Create VM with virt-install

Create new VM from iso-image (512 MB, 5 GB Disk):

sudo virt-install -n ubuntu-desktop -r 512 -f ubuntu-desktop.img -s 5 -c ubuntu-desktop.iso --accelerate --vnc --noautoconsole

Connect to VM Server:

$ virt-viewer -c qemu+ssh://ubuntu-server.local/system ubuntu-desktop

Manage your virtual machines

From console:

$ sudo virsh

# commands
list
shutdown
start
define  # to reload config
destroy
suspend
resume

With GUI:

$ virt-manager -c qemu+ssh://ubuntu-server.local/system