Creating dom0
Login as root (sudo su)
Install required packages and the hypervisor
apt-get install xen-hypervisor-4.1-amd64
apt-get install xen-utils-4.1
apt-get install xenwatch
apt-get install xen-tools
apt-get install xen-utils-common
apt-get install xenstore-utils
apt-get install virtinst
apt-get install virt-viewer
apt-get install virt-manager
Now you have installed everything you need to run your dom0. Before you restart your system edit “/etc/xen/xend-config.sxp” and add the following (rather uncomment)
(xend-unix-server yes)
Next restart your system and pick the xen-kernel from the grub menu (if you want you can edit /etc/default to pick the correct kernel automatically). Now you are good to go.
Simply run “xm info” or “xm list”, you will see your system is running.
Creating a domU
Now Here are the steps to create an Ubuntu Lucid guest (domU) using xen-create-image utility, for that follow following steps.
Step1: go to /etc/xen-tools (edit xen-tools.conf or create a new conf file)
Step 2: Configure it as follows
dir = /mnt/xen
install-method = debootstrap
size = 8Gb # Disk image size.
memory = 1024Mb # 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 = lucid # Default distribution to install.
image = sparse
dhcp = 1
nameserver = IP address of DNS Server
bridge = virbr0
kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
mirror = http://archive.ubuntu.com/ubuntu
ext3_options = noatime,nodiratime,errors=remount-ro
ext2_options = noatime,nodiratime,errors=remount-ro
xfs_options = defaults
reiserfs_options = defaults
btrfs_options = defaults
boot = 1
passwd = 1
serial_device = hvc0
disk_device = xvda
Step 4: now run
xen-create-image –hostname=Ubuntu10
Step 3: In the middle of the image creation it will ask for the root password, simply put the password you like. Your domain will start automatically
Step 4: You can login to it using
xm console Ubuntu10
to terminate
xm destroy Ubuntu10
To restart
xm create –c /etc/Ubuntu10.cfg