KvmVirtManagerEtc
This is still work in progress! Feel free to jump in and extend this documentation!
Basic info
Ubuntu uses [http://kvm.qumranet.com/ kvm] as the backend virtualisation technology. To manage VM's we use [http://libvirt.org/ libvirt] as the basic toolbox and [http://virt-manager.et.redhat.com/ virt-manager] as the graphical frontend for managing your vm's.
Why virtualise?
Virtualisation is being adopted in many different environments and situations. If you're a developer, virtualisation can provide you with a contained environment where you can safely do almost any sort of development safe from messing up your main working environment. If you're a systems administrator, you can use virtualisation to more easily separate your services and move them around based on the demand they're seeing.
How to get started
You need to install a few packages first:
$ sudo aptitude install virt-manager kvm libvirt-bin
- virt-manager is the gui.
- libvirt-bin provides libvirtd which you need to administer qemu and kvm instances using libvirt
- kvm is the backend
Next, you want to add yourself to the libvirt group. If your username if joe, you run:
$ sudo adduser joe libvirtd
This will give you access to the system-wide libvirtd instance. This is preferable for you because it gives you access to the advanced networking options rather than simply the "userspace networking" option as you may know it from QEmu.
Note: You need to log out and log back in for the new group membership to take effect.
Once that's done, you can test if it worked by issuing the following command:
$ virsh -c qemu:///system list Id Name State ---------------------------------- $
If on the other hand you get something like this:
$ virsh -c qemu:///system list libvir: Remote error : Permission denied error: failed to connect to the hypervisor $
Something is wrong and you probably want to fix this before you move on. The critical point here is whether or not you have write access to /var/run/libvirt/libvirt-sock.
Ok, now that that's sorted, you can fire up virt-manager. The first time we do this, we pass it the exact libvirt URI we want to connect to. Subsequently, virt-manager will remember this URI and present it in its UI, so you should only really need this the first time.
$ virt-manager -c qemu:///system
TODO: Insert screenshot here
You can now set up your first VM! Click the line that says "localhost" and then click the "New" button.
Virt-manager will ask you a few questions about your new VM.
- First, you give it a name.
- Next, you choose which type of virtualisation you want to use. You want to choose "Fully virtualised" and either "x86_64" or "i686" as the CPU architecture, and finally enable "Enable kernel / hardware acceleration". That last checkbox decides whether you're invoking qemu or kvm.
- Next, you choose the location of your ISO image that will be used during installation.
- Next, you choose your storage details. The simplest approach is to use the "Simple file" option. You enter the location of the image, and set a size. If you've got loads of space, you'll get an increase in performance if you enable "Allocate entire virtual disk now?", but deselecting that is also fine.
- Next, your choose your network settings. "Usermode network" is almost never what you want. "Virtual network" is usually the best default. It connects your vm to a virtual network that libvirt has set up. It resides at 192.168.122.0/24 and there's a router at 192.168.122.1. You'll notice your host also has a virbr0 interface (which will be brought up when the first guest vm using it is fired up) connected to the same virtual network.
- Finally, you choose your memory settings and decide on the number of CPU's the guest should see.
- All you need to do now, is acknowledge these settings and you're done.
Note: There seems to be an issue right now with showing the gfxboot screen. You will not be able to see the menu, but you can just press Return and the installation will continue.