As a follow up to my previous post, where I installed Xen onto Ubuntu 10.04, in this post, I will use debootstrap to create a DomU Ubuntu 10.04 sparse image.
Begin by installing debootstrap: apt-get install debootstrap
Create a sparse image (1 GB) -- sparse is attractive as it doesn't use real disk space until the image has content: dd if=/dev/null of=ubuntu.img bs=1M seek=1024
Create an ext3 file system in the image: mkfs.ext3 ubuntu.img
Prepare for debootstrap:
mkdir ubuntu
mount -oloop ubuntu.img ubuntu
Run debootstrap: debootstrap lucid ubuntu http://us.archive.ubuntu.com/ubuntu/
Add the Xen console device to init: sed 's/tty1/hvc0/' ubuntu/etc/init/tty1.conf > ubuntu/etc/init/hvc0.conf
Add network initialization to your image by adding the following or something similar to ubuntu/etc/network/interfaces:
auto eth0
iface eth0 inet dhcp
Set a root password:
chroot ubuntu
passwd
(set password)
Clean up:
umount ubuntu
rmdir ubuntu
Create a xen configuration file (ubuntu.cfg):
kernel = "/boot/vmlinuz-2.6.32.27"
ramdisk = "/boot/initrd.img-2.6.32.27"
memory = 64
name = "ubuntu"
root = "/dev/xvda ro"
disk = [ "file:/root/ubuntu.img,xvda,w" ]
vif = ['bridge=eth0']
The above assumes your kernel is Xen kernel 2.6.32.27, the current working directory is "/root", and your default network device is "eth0". Adjust as necessary. Also the memory is configurable, the default listed above is 64M.
Check that everything works -- assuming xen is on (verify xm list): xm create -c ubuntu.cfg
It should boot into a domain that you can log into as root.
Tuesday, January 11, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment