Table of Contents

Xen-tools

= Setting up Trainee Admin Xen VMs Automatically =

This how-to guide covers streamlining the setting up of Xen VMs using xen-tools. The setting up of Xen and VMs is also discussed here: Admin/SetupGuides/SettingUpXenVMs

In brief, to Create a VM

ssh dom0 xen-create-image –hostname dom0-vm## –ip 192.168.0.15



Documented Procedure on getting to the above stage:

1. Install Xen

apt-get install linux-image-2.6-xen-686 xen-hypervisor-3.0.3-1-i386-pae xen-tools bridge-utils libc6-xen sysfsutils

2. Setup Xen to use Bridge Networking

vi /etc/xen/xend-config.sxp (vif-script vif-bridge) (network-script network-bridge)

3. Reboot dom0 and Check Xen

xm list #shows machines running

ifconfig #you should see entries for: peth0 and xenbr0

4. Configure Xen-tools

This step shows all the settings which were required: vi /etc/xen-tools/xen-tools.conf #uncommented lines are as follows: lvm = hexvg debootstrap = 1 size = 4Gb # Disk image size. memory = 64Mb # Memory size 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 = etch # Default distribution to install. image = sparse # Specify sparse vs. full disk images. gateway = 192.168.0.1 netmask = 255.255.255.0 passwd = 1 kernel = /boot/vmlinuz-2.6.18-4-xen-686 initrd = /boot/initrd.img-2.6.18-4-xen-686 mirror = http://ftp.ie.debian.org/debian/

Configure /etc/profile to use a proxy on dom0: vi /etc/profile export http_proxy=“http://proxy:3128” #case sensitive for debootstrap!!

Copy files for domU skeleton as follows: mkdir -p /etc/xen-tools/skel/root/.ssh/ mkdir -p /etc/xen-tools/skel/etc/

cp /root/.ssh/authorized_keys2 /etc/xen-tools/skel/root/.ssh/ cp /etc/profile /etc/xen-tools/skel/etc/

5. Manage xen-tools

Xen-tools is a front end, doing a lot of things:

Note, the settings which are not specified on the command line are kept in: /etc/xen-tools/xen-tools.conf xen-create-image –hostname hex-vm04 –ip 192.168.0.15

xen-delete-image hex-vm04 #cleanly delets the vm, including removing the lvm partition!

xen-list-images

Xen Specific Tools: xm create /etc/xen/hex-vm04.cfg #VMs still need to be started manually.

xm console hex-vm04 #serial console in. Hit CTRL + } to escape

xm shutdown hex-vm04 #brings down the VM

Conclusion

apt-get remove locales apt-get install locales dpkg-reconfigure locales tzconfig