Xen quick start

2007-01-08 3-minute read

Here are the quick steps for turning a stock Debian Etch machine into a xen machine:

  • Install with: apt-get install xen-hypervisor-3.0.3-1-i386 xen-linux-system-2.6.18-4-xen-686 libc6-xen

  • Edit /boot/grub/menu.1st. Modify the following line so that the dom0 doesn’t take up all the available RAM. This mod only gives dom0 128 MB

    Xen hypervisor options to use with the default Xen boot option

    xenhopt=dom0_mem=131072

  • Update grub and reboot update-grub shutdown -r now
  • Modify /etc/xen/xend-config.sxp. We made the following diff:
    0 sontag:/etc/xen# diff -u xend-config.sxp /root/xend-config.sxp
    --- xend-config.sxp     2006-11-13 09:13:37.000000000 -0500
    +++ /root/xend-config.sxp       2007-06-01 08:30:20.000000000 -0400
    @@ -68,7 +68,7 @@
    #
    # use
    #
    -# (network-script network-bridge)
    +(network-script network-bridge)
    #
    # Your default ethernet device is used as the outgoing interface, by default.
    # To use a different one (e.g. eth1) use
    @@ -84,7 +84,7 @@
    # two fake interfaces per guest domain.  To do things like this, write
    # yourself a wrapper script, and call network-bridge from it, as appropriate.
    #
    -(network-script network-dummy)
    +# (network-script network-dummy)
    
    # The script used to control virtual interfaces.  This can be overridden on a
    # per-vif basis when creating a domain or a configuring a new vif.  The
    1 sontag:/etc/xen#
    
  • Install bridge-utils (for needed for networking) and xen-tools (to make creating and manipulating xen instances a lot easier) aptitude install bridge-utils xen-tools /etc/init.d/xend restart
  • Edit /etc/xen-tools/xen-tools.conf. For our purpose we made the following changes:
    0 gramsci:/etc/xen-tools# diff -u xen-tools.conf.orig xen-tools.conf
    --- xen-tools.conf.orig 2007-05-27 19:59:38.000000000 -0400
    +++ xen-tools.conf      2007-05-27 20:01:15.000000000 -0400
    @@ -35,6 +35,7 @@
    #
    ##
    # lvm = skx-vg
    +lvm = vg_gramsci0
    
    
    #
    @@ -61,7 +62,7 @@
    ##
    #
    # copy = /path/to/pristine/image
    -# debootstrap = 1
    +debootstrap = 1
    # rpmstrap = 1
    # tar = /path/to/img.tar
    #
    @@ -95,7 +96,7 @@
    swap   = 128Mb    # Swap size
    # noswap = 1      # Don't use swap at all for the new system.
    fs     = ext3     # use the EXT3 filesystem for the disk image.
    -dist   = sarge    # Default distribution to install.
    +dist   = etch     # Default distribution to install.
    image  = sparse   # Specify sparse vs. full disk images.
    
    #
    @@ -154,8 +155,8 @@
    #
    # Default kernel and ramdisk to use for the virtual servers
    #
    -kernel = /boot/vmlinuz-2.6.16-2-xen-686
    -initrd = /boot/initrd.img-2.6.16-2-xen-686
    +kernel = /boot/vmlinuz-2.6.18-4-xen-686
    +initrd = /boot/initrd.img-2.6.18-4-xen-686
    
    #
    #  The architecture to use when using debootstrap or rpmstrap.
    1 gramsci:/etc/xen-tools#
    
  • Create new xen instances with: xen-create-image --size=5Gb --memory=1GB --swap=512Mb --gateway=209.51.180.17 --netmask=255.255.255.240 --ip=209.51.180.24 --hostname=mendes

    Change settings as needed.

  • Start with: xm create -c mendes.cfg
  • Optionally, add more partitions: lvcreate --size=5GB --name=mendes-var vg_gramsci0 Then, edit /etc/xen/mendes.cfg and modify the line that starts with "Disks."
  • Log into the console (root, no password): xm console mendes