Comments on Virtualization With KVM On Ubuntu 12.04 LTS

Virtualization With KVM On Ubuntu 12.04 LTS This guide explains how you can install and use KVM for creating and running virtual machines on an Ubuntu 12.04 LTS server. I will show how to create image-based virtual machines and also virtual machines that use a logical volume (LVM). KVM is short for Kernel-based Virtual Machine and makes use of hardware virtualization, i.e., you need a CPU that supports hardware virtualization, e.g. Intel VT or AMD-V.

8 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Anonymous

'sudo -i' is the preferred way to gain permanent root via sudo.

By: rpjday

It seems like installing libvirt-bin automatically adds the invoking userid to that group.  At least *something* seems to add you to that group.

 You do, however, still have to add yourself to the "kvm" group, so that part is unchanged.

By: Lisandro

Its important to check that CPU virtualization is enabled with this command:

root@localhot: kvm-ok

 Or you will get this error:

'/var/run/libvirt/libvirt-sock': "No such file" 

By: Anonymous

i used the brctl commands to add the bridge as the bridge_xxxx didn't work for me

further details @ https://help.ubuntu.com/community/NetworkConnectionBridge

 add these in /etc/network/interfaces after bridge address/subnet/dns data etc.

pre-up ip link set eth0 up
pre-up brctl addbr br0
pre-up brctl addif br0 eth0
pre-up ip addr flush dev eth0
post-down ip link set eth0 down
post-down ip link set br0 down
post-down brctl delif br0 eth0
post-down brctl delbr br0
then restart the network interface

 sudo /etc/init.d/networking restart


 thanks for the help -  i'm trying qemu-kvm as xen 4.1 doesn't seem to want to boot with 12.04

By: Pubudu Kodikara

Still bridge networking doesn't work :( The guest machines can't connect to the network. Please help!

By: frhamard

Thank you for this great and clear article. Do you think you can add a part on how to connect to the host with virt-manager? 

 

By: Anonymous

how do I install centos as a virtual machine?

By: Nexusguy59

I am not sure what I am doing wrong, but here is what I get when I try to create a new vm:

root@hood:/var/lib/libvirt/images/vm1# vmbuilder kvm ubuntu --suite=precise --flavour=virtual --arch=amd64 --mirror=http://us.archive.ubuntu.com/ubuntu -o --libvirt=qemu:///system --ip=192.168.x.xx --gw=192.168.x.x --part=vmbuilder.partition --templates=templates --user=administrator --name=Administrator --pass=mypassword --addpkg=nano --addpkg=unattended-upgrades --addpkg=acpid --firstboot=/var/lib/libvirt/images/vm1/boot.sh --mem=1048 --hostname=pegasus --bridge=br0

[5] 20184

2015-06-29 07:20:16,261 INFO    : logging to file: /tmp/tmpH8JQBh

2015-06-29 07:20:16,283 INFO    : Calling hook: preflight_check

2015-06-29 07:20:16,285 INFO    : Calling hook: set_defaults

2015-06-29 07:20:16,285 INFO    : Calling hook: bootstrap

boot.sh: command not found

As you can see the boot.sh does exist in the path:

root@hood:/var/lib/libvirt/images/vm1# ls -al

total 20

drwxr-xr-x 3 root root 4096 Jun 29 07:13 .

drwx--x--x 5 root root 4096 Jun 29 07:06 ..

-rw-r--r-- 1 root root  225 Jun 29 07:18 boot.sh

drwxr-xr-x 3 root root 4096 Jun 29 07:08 templates

-rw-r--r-- 1 root root   36 Jun 29 07:10 vmbuilder.partition

not sure what I am doing wrong, Oh this is on 14.04 Trusty Tahr

Thanks,

Michael