« HOWTO Setup and Configure AutofsHOWTO Use dnsmasq »

HOWTO Sort out kvm

20/07/08

HOWTO Sort out kvm

Installation.

The Kernel Virtual Machine It is a fast and simple way to run entire operating systems, inside Linux. I use them for playing around with stuff as they are simple to create. It saves having to put your live machine back together again.

Follow up:

Install Using The 'apt-get' Software

Install command
sudo apt-get install kvm libvirt-bin virt-manager virt-viewer ubuntu-vm-builder
You need to install ubuntu-vm-builder as it includes "something" that virt-install uses. Virt-install will not run correctly without it.

So your user can use the tools

Then, add yourself to the libvirtd and kvm groups. This mans that your own user can create and run kvm guests and the guests are reasonable secure as the processes are run by a user with few permissions. You can also take advantage of the system networking and not have to use the really slow and CPU intensive userbase networking.

The id -un command will print the users identity, useful command when writing HOWTOs. Try it out on its own.

Adding Users
sudo adduser `id -un` libvirtd  
sudo adduser `id -un` kvm 
You need to log out and log back in for the new group membership to take effect.

You can test if your install has been successful with the following command:

Quick Test Command
virsh -c qemu:///system list  
 
 Id Name                 State  
---------------------------------- 

If you get an error message then you still have a problem. You did logout and back in again didn't you?

virsh -c qemu:///system list  
libvir: Remote error : Permission denied  
error: failed to connect to the hypervisor 

The usual problem is that you do not have write access to /var/run/libvirt/libvirt-sock. The sock file should have permissions similar to

ls -l  srwxrwx--- 1 root libvirtd 0 2008-05-11 12:08 /var/run/libvirt/libvirt-sock=  

And you should see the libvirtd when you run the groups command as your user. If both of these are correct and you reinstalled kvm after trying this before there can also be a problem with ssh known-hosts keys. Move the known-hosts file to something new and create a blank one then try again. If it was a problem with known-host keys you should see get a question. Answer "yes" and press return.


Pages: 1 · 2 · 3

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
What can birds and aeroplanes both do?
antispam test