Playing with Xen

This is about playing with Xen on Debian (testing)

Setting up Domain-0

If X11 going to be used deactivate any proprietary nvidia or ATI drivers (e.g. in xorg.conf change the nvidia Driver to nv).

  • $ apt-get install xen-linux-system-2.6.18-3-xen-k7 bridge-utils
  • $ reboot
  • choose newly installed Xen Kernel in grub menu
  • $ cat /proc/version
Linux version 2.6.18-3-xen-k7 (Debian 2.6.18-7) (waldi@debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)) #1 SMP Mon Dec 4 21:30:18 UTC 2006
  • $ xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      940     1 r-----     64.1

Installing a virtual machine

Installing Ubuntu "edgy"

I took a lot of information from external http://blog.rootserverexperiment.de/2006/07/22/ubuntu-als-domu-xen-debootstrappen/

  • Get the Ubuntu debootstrap from http://packages.ubuntu.com/ and extract the edgy script and put it under /usr/lib/debootstrap/scripts/
  • Create hd image:
    • dd if=/dev/zero of=hda1.img bs=1048576 count=4096
    • mkfs.ext3 hda1.img
  • Mount image
    • mkdir /tmp/ubuntu
    • mount -o loop hda1.img /tmp/ubuntu
  • Bootstrap installation
  • Configuration of VM
    • mount -t proc none /tmp/ubuntu/proc
    • mount -t devpts none /tmp/ubuntu/dev/pts
    • LANG=C chroot /tmp/ubuntu /bin/bash
    • configure network, interfaces, hosts, hostname, fstab and resolve.conf
  • Get Xen kernel for the VM from external http://cdprojekte.mattiasschlenker.de/Public/Xen-Kernel/
  • Install kernel and modules in /tmp/ubuntu and put a copy of the kernel to a place where your host can find it.
  • umount /tmp/ubuntu

  • Edit /etc/xen/xend-config.sxp and enable network bridging, make sure that these two lines are active:
    • (network-script network-bridge)
    • (vif-script vif-bridge)

  • Edit ubuntu.cfg:
kernel = "/xen/debian/boot/vmlinuz-2.6.16.29-xenU-mfs20061103-i686-single"
memory = 128
name = "ubuntu-minimal"
vif = [ 'mac=00:16:00:00:00:07' ]
disk = [ 'file:/xen/debian/hda1.img,hda1,w' ]
root = "/dev/hda1 rw"
  • xm create -c ubuntu.cfg

Installing Debian sarge

  • same as above BUT
    • Use the same "xen" kernel and modules for Dom0 and DomU! (Don't know how to configure a "generic" Xen DomU kernel)
    • debian.cfg:
kernel = "/boot/vmlinuz-2.6.18-3-xen-k7"
ramdisk = "/boot/initrd.img-2.6.18-3-xen-k7"
memory = 128
name = "debian-vm"
vif = [ 'mac=00:16:00:00:00:08' ]
disk = [ 'file:/xen/debian/debian.img,hda1,w' ]
root = "/dev/hda1 rw"

  • $ xm list:
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      874     1 r-----   2439.5
debian-vm                                 29      128     1 -b----    133.2

Other sources of information

-- MatthiasWientapper - 17 Dec 2006

 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding mattzz? Send feedback