Differences between revisions 8 and 9
Revision 8 as of 2013-10-21 14:29:39
Size: 5344
Editor: ?aseques
Comment: simplified checks for vmx support
Revision 9 as of 2013-10-22 08:22:32
Size: 6152
Editor: ?aseques
Comment: Updated config details for wheezy + lvm details.
Deletions are marked like this. Additions are marked like this.
Line 26: Line 26:
=== Debian 6.0 Install Xen ===
=== Debian Install Xen ===

For debian 7.0 (wheezy)
{{{
apt-get install xen-linux-system
}}}

For debian 6.0 (squeeze)
Line 32: Line 38:
Boot Xen kernel by default Boot Xen kernel by default (both in wheezy and squeeze), without this change the kernel will boot not being dom0
Line 38: Line 44:
==== Firewall ====

== Management tools ==
=== Management tools ===
Line 45: Line 49:
  ==== Using lvm disks ====

If you want that the new domU are created using the space from a lvm pool, you have to configure libvirt to use it, to do so, you need to create the entry pointing to you pool (in this case lvmspace)


vi /etc/libvirt/storage/lvmspace.xml
{{{
<pool type='logical'>
  <name>lvmspace</name>
  <target>
    <path>/dev/lvmspace</path>
  </target>
</pool>
}}}

To include this pool into libvirt
{{{
virsh pool-define /etc/libvirt/storage/lvmspace.xml
virsh pool-start lvmspace
virsh pool-autostart lvmspace
virsh pool-info lvmspace
}}}

==== Using disk images ====
Line 59: Line 87:
==== Remote connection ====
Line 69: Line 99:
On debian squeeze the default value for this parameter is “no” which means that communication and management tools On debian wheezy/squeeze the default value for this parameter is “no” which means that communication and management tools

Translation(s): none


Installing Xen

CPU BIOS Requirements

Virtualization extensions need to be enabled in the BIOS. If not already enabled in BIOS, enable it.

CPU needs to have virtualization extensions.

To check in both Intel and AMD CPUs:

egrep '(vmx|svm)' /proc/cpuinfo

For XEN kernel, check output of the following for 'hvm':

xm dmesg | grep VMX

Debian Install Xen

For debian 7.0 (wheezy)

apt-get install xen-linux-system

For debian 6.0 (squeeze)

apt-get install xen-linux-system xen-qemu-dm xen-utils

Boot Xen kernel by default (both in wheezy and squeeze), without this change the kernel will boot not being dom0

dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen

Management tools

apt-get install libvirt-bin

Using lvm disks

If you want that the new domU are created using the space from a lvm pool, you have to configure libvirt to use it, to do so, you need to create the entry pointing to you pool (in this case lvmspace)

vi /etc/libvirt/storage/lvmspace.xml

<pool type='logical'>
  <name>lvmspace</name>
  <target>
    <path>/dev/lvmspace</path>
  </target>
</pool>

To include this pool into libvirt

virsh pool-define /etc/libvirt/storage/lvmspace.xml 
virsh pool-start lvmspace
virsh pool-autostart lvmspace
virsh pool-info lvmspace

Using disk images

*Change the default location to /home/xen/images: Edit:

vi /etc/libvirt/storage/default.xml

And change the location. Reason I'm doing that is my home partition has 80Gb while / (root) partition has only 5gb.

#from:
/var/lib/libvirt/images/
#to
/home/xen/images

Remote connection

apt-get install virt-manager

* If you want to connect over ssh tunnel you need:

aptitude install ssh-askpass

On debian wheezy/squeeze the default value for this parameter is “no” which means that communication and management tools
Such as “Virt Manager” can not access the Hypervisor.

1. You need to uncomment it and change the value to “yes” –
(xend-unix-server yes)

2. Restart xend to apply the new configuration:
xend restart

Start Networking

  • To start the default network do:

virsh net-start default
#or
virsh net-autostart default

Installing new guest OS

Create iso from cdrom

dd if=/dev/cdrom of=~/cd_image.iso

Windows 7

windows7.png

Maintenance

Extending xen raw_storage_volume

Starting Networking

  • To start the default network do:

virsh net-start default
#or
virsh net-autostart default
  • Done.
  • *The libvirt-bin package comes with this default network defined here: /etc/libvirt/qemu/networks/default.xml
  • *If you remove the network or this file is missing you will need to recreate it manually. The default.xml contains:

<network>
  <name>default</name>
  <bridge name="virbr0" />
  <forward/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254" />
    </dhcp>
  </ip>
</network>

Disable virbr0

ifconfig
  • Make sure the virbr0 is listed

virsh net-list
  • make sure default is listed. Below will delete /etc/libvirt/qemu/networks/default.xml . Make a copy before you delete it otherwise the only way to get it back is to purge libvirt-bin libvirt0 and reinstall.

virsh net-destroy default
virsh net-undefine default
service libvirtd restart
ifconfig 

Errors

Error creating domain: device model '/usr/lib64/xen/bin/qemu-dm' not found

Unable to complete install '<class 'libvirt.libvirtError'> POST operation failed: xend_post: error from 
xen daemon: (xend.err "Error creating domain: device model '/usr/lib64/xen/bin
/qemu-dm' not found")

Solution:

mkdir /usr/lib64/xen/
ln -s /usr/lib/xen-4.0/bin /usr/lib64/xen/bin

iptables bad rule

  • Also similar error virtual network 'default' does not exist: Network not found: no network with matching name

libvirtError: internal error '/sbin/iptables --table filter --delete INPUT --in-interface virbr0 --protocol udp --destination-port 69 --jump ACCEPT' exited with non-zero status 1 and signal 0: iptables: Bad rule (does a matching rule exist in that chain?).

Solution

This is trying to bound to interface virbr0. If for some reason you didn't start the network you will get this error. Start the network:

virsh net-start default
#or autostart it
virsh net-autostart default
  • Check if networks got started:

ifconfig
  • Done
  • Couple other helpful commands:

virsh net-dumpxml default

**Notes (Looks like these steps are not needed):

**trying to test this. read: vi /usr/share/doc/libvirt-bin/README.Debian

  • Need to modify the dnsmasq to support libvirt and only connect to localhost. Run this on a command line as root

aptitude install dnsmasq-base bridge-utils iptables
cat <<EOF >/etc/dnsmasq.d/00_libvirtd.conf
# only bind to loopback by default
interface=lo
bind-interfaces
EOF
  • This makes dnsmasq only bind to the loopback interface by default so libvirtd

can handle the virtual bridges.

Sources