Virtualization With KVM On An OpenSUSE 12.2 Server

Version 1.0
Author: Falko Timme
Follow me on Twitter

This guide explains how you can install and use KVM for creating and running virtual machines on an OpenSUSE 12.2 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.

I do not issue any guarantee that this will work for you!


1 Preliminary Note

I'm using an OpenSUSE 12.2 server with the hostname and the IP address here as my KVM host.

We also need a desktop system where we install virt-manager so that we can connect to the graphical console of the virtual machines that we install. I'm using an OpenSUSE 12.2 desktop here.


2 Installing KVM

OpenSUSE 12.2 KVM Host:

First check if your CPU supports hardware virtualization - if this is the case, the command

egrep '(vmx|svm)' --color=always /proc/cpuinfo

should display something, e.g. like this:

server1:~ # egrep '(vmx|svm)' --color=always /proc/cpuinfo
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
 nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good extd_apicid pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch lbrv
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
 nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good extd_apicid pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch lbrv
server1:~ #

If nothing is displayed, then your processor doesn't support hardware virtualization, and you must stop here.

To install KVM and virtinst (a tool to create virtual machines), we run

zypper install  kvm libvirt libvirt-python qemu virt-manager

Unfortunately libvirt-python conflicts with the package patterns-openSUSE-minimal_base-conflicts. Therefore we must choose to uninstall that package:

Problem: libvirt-python- requires python = 2.7, but this requirement cannot be provided
  uninstallable providers: python-2.7.3-3.6.1.x86_64[openSUSE-12.2-1.6]
 Solution 1: Following actions will be done:
  do not install libvirt-python-
  do not install virt-manager-0.9.4-1.6.1.x86_64
 Solution 2: Following actions will be done:
  do not install virt-manager-0.9.4-1.6.1.x86_64
  do not install libvirt-python-
 Solution 3: deinstallation of patterns-openSUSE-minimal_base-conflicts-12.2-5.5.1.x86_64
 Solution 4: break libvirt-python- by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/4/c] (c):
 <-- 3

Then create the system startup links for libvirtd...

 systemctl enable  libvirtd.service

... and start the libvirt daemon:

systemctl start libvirtd.service

To check if KVM has successfully been installed, run

virsh -c qemu:///system list

It should display something like this:

server1:~ # virsh -c qemu:///system list
WARNING: no socket to connect to
 Id Name                 State

server1:~ #

If it displays an error instead, then something went wrong.

Next we need to set up a network bridge on our server so that our virtual machines can be accessed from other hosts as if they were physical systems in the network.

To do this, we install the package bridge-utils...

zypper install  bridge-utils

... and configure a bridge.

To configure the bridge, create the file /etc/sysconfig/network/ifcfg-br0 as follows (make sure you use the IPADDR setting from the /etc/sysconfig/network/ifcfg-eth0 file):

vi /etc/sysconfig/network/ifcfg-br0
NAME='Bridge 0'

(If you get the message You do not have a valid vim binary package installed. Please install either "vim", "vim-enhanced" or "gvim"., please run

zypper install  vim

to install vi and try again. )

Modify /etc/sysconfig/network/ifcfg-eth0 as follows (set IPADDR to and change STARTMODE to hotplug):

vi /etc/sysconfig/network/ifcfg-eth0
NAME='MCP77 Ethernet'

Then restart the network:

systemctl restart network.service

Afterwards, run


It should now show the network bridge (br0):

server1:~ # ifconfig
br0       Link encap:Ethernet  HWaddr 00:1E:90:F3:F0:02
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::21e:90ff:fef3:f002/64 Scope:Link
          RX packets:92 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:12716 (12.4 Kb)  TX bytes:5961 (5.8 Kb)

eth0      Link encap:Ethernet  HWaddr 00:1E:90:F3:F0:02
          inet6 addr: fe80::21e:90ff:fef3:f002/64 Scope:Link
          RX packets:131711 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80954 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:185764801 (177.1 Mb)  TX bytes:6374023 (6.0 Mb)
          Interrupt:41 Base address:0x8000

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:860 (860.0 b)  TX bytes:860 (860.0 b)

server1:~ #


3 Installing virt-manager On Your OpenSUSE 12.1 Desktop

OpenSUSE 12.2 Desktop:

We need a means of connecting to the graphical console of our guests - we can use virt-manager for this. I'm assuming that you're using an OpenSUSE 12.2 desktop.

Become root...


... and run...

zypper install  virt-manager libvirt

... to install virt-manager.

(If you're using an Ubuntu 11.10 desktop, you can install virt-manager as follows:

sudo apt-get install virt-manager



4 Creating A Debian Squeeze Guest (Image-Based)

OpenSUSE 12.2 KVM Host:

Now let's go back to our OpenSUSE 12.2 KVM host.

Take a look at

virt-install --help 

to learn how to use it.

We will create our image-based virtual machines in the directory /var/lib/libvirt/images/ which was created automatically when we installed KVM in chapter two.

To create a Debian Squeeze guest (in bridging mode) with the name vm10, 512MB of RAM, two virtual CPUs, and the disk image /var/lib/libvirt/images/vm10.img (with a size of 12GB), insert the Debian Squeeze Netinstall CD into the CD drive and run

virt-install --connect qemu:///system -n vm10 -r 512 --vcpus=2 --disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /dev/cdrom --vnc --noautoconsole --os-type linux --os-variant debiansqueeze --accelerate --network=bridge:br0 --hvm

Of course, you can also create an ISO image of the Debian Squeeze Netinstall CD (please create it in the /var/lib/libvirt/images/ directory because later on I will show how to create virtual machines through virt-manager from your OpenSUSE 12.2 desktop, and virt-manager will look for ISO images in the /var/lib/libvirt/images/ directory)...

dd if=/dev/cdrom of=/var/lib/libvirt/images/debian-6.0.0-amd64-netinst.iso

... and use the ISO image in the virt-install command:

virt-install --connect qemu:///system -n vm10 -r 512 --vcpus=2 --disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /var/lib/libvirt/images/debian-6.0.0-amd64-netinst.iso --vnc --noautoconsole --os-type linux --os-variant debiansqueeze --accelerate --network=bridge:br0 --hvm

The output is as follows:

server1:~ # virt-install --connect qemu:///system -n vm10 -r 512 --vcpus=2 --disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /var/lib/libvirt/images/debian-6.0.0-amd64-netinst.iso --vnc --noautoconsole --os-type linux --os-variant debiansqueeze --accelerate --network=bridge:br0 --hvm
WARNING: no socket to connect to

Starting install...
Allocating 'vm10.img'       |  12 GB     00:00
Creating domain...          |    0 B     00:00
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
server1:~ #

Share this page:

1 Comment(s)

Add comment

Please register in our forum first to comment.



The same tutorial can be used for OpenSUSE 12.3, but one important package needs installing: xauth

Use: zypper in xauth

This makes X11 forwarding work with SSH.