| Rich ( @ 2005-12-22 10:56:00 |
Xen
Been trying to figure out Xen and get it running reliably.
So far....
Also this is using the binary files for Xen, once I have a spare box free I'll modify this to include patching the kernel so you don't have to reboot into a Xen kerenl.
Decide where the images will live. (/opt /home /var, whatever)
mkdir -p /opt/xen/bin
cd /opt/xen/bin
wget http://bits.xensource.com/Xen/latest/xe n-3.0.0-install-x86_32.tgz
untar the file
./install.sh
update-rc.d xend defaults
update-rc.d xendomains defaults
mv /lib/tls /lib/tls.disabled <-- trying to find a way around this, maybe it's a waste of time though...
add to /boot/grub/menu.lst
title Xen 3.0 / XenLinux 2.6
kernel /boot/xen-3.0.gz dom0_mem=262144
module /boot/vmlinuz-2.6-xen0 root=/dev/hda1 ro console=tty0
apt-get install bridge-utils iproute debootstrap
mkdir -p /opt/xen/domains/vm01
dd if=/dev/zero of=/opt/xen/domains/vm01/diskimage bs=1024k count=1024 (count=1024 assumes 1 GB drive, adjust accordingly)
dd if=/dev/zero of=/opt/xen/domains/vm01/swapimage bs=1024k count=128 (128 MB swap adjust accordingly)
mkfs.ext3 /opt/xen/domains/vm01/diskimage
mkswap /opt/xen/domains/vm01/swapimage
mkdir /mnt/disk
mount -o loop /opt/xen/domains/vm01/diskimage /mnt/disk
debootstrap --arch i386 sarge /mnt/disk http://ftp.us.debian.org/debian
chroot /mnt/disk /bin/bash
cd /etc; vi hostname hosts resolv.conf
create fstab
/dev/sda1 / ext3 errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
proc /proc proc defaults 0 0
logout and umount
configure Xen machine
cat > /etc/xen/vm01.cfg
kernel = "/boot/vmlinuz-2.6.12.6-xenU"
memory = 96
name = "vm01"
dhcp = "dhcp"
disk = [ 'file:/opt/xen/domains/vm01/diskimage,sd a1,w','file:/opt/xen/domains/vm01/swapim age,sda2,w' ]
root = "/dev/sda1 ro"
start the Xen machine
xm create vm01 -c (-c connects a console, if omitted use xm console vm01)
login as root (no password set yet)
passwd
apt-setup or base-config
apt-get update && apt-get upgrade
This is not the easiest, or even best way to do this but I've only been looking at it for about 2 hours and this is what I have so far.
UPDATE
disk = [ 'phy:/dev/hdX,hda1,w', 'phy:/dev/hdY,hda2,w' ] <-- partitions instead of files guess LVM would run in a similiar manner
REFERENCES
http://julien.danjou.info/xen.html
Been trying to figure out Xen and get it running reliably.
So far....
Also this is using the binary files for Xen, once I have a spare box free I'll modify this to include patching the kernel so you don't have to reboot into a Xen kerenl.
Decide where the images will live. (/opt /home /var, whatever)
mkdir -p /opt/xen/bin
cd /opt/xen/bin
wget http://bits.xensource.com/Xen/latest/xe
untar the file
./install.sh
update-rc.d xend defaults
update-rc.d xendomains defaults
mv /lib/tls /lib/tls.disabled <-- trying to find a way around this, maybe it's a waste of time though...
add to /boot/grub/menu.lst
title Xen 3.0 / XenLinux 2.6
kernel /boot/xen-3.0.gz dom0_mem=262144
module /boot/vmlinuz-2.6-xen0 root=/dev/hda1 ro console=tty0
apt-get install bridge-utils iproute debootstrap
mkdir -p /opt/xen/domains/vm01
dd if=/dev/zero of=/opt/xen/domains/vm01/diskimage bs=1024k count=1024 (count=1024 assumes 1 GB drive, adjust accordingly)
dd if=/dev/zero of=/opt/xen/domains/vm01/swapimage bs=1024k count=128 (128 MB swap adjust accordingly)
mkfs.ext3 /opt/xen/domains/vm01/diskimage
mkswap /opt/xen/domains/vm01/swapimage
mkdir /mnt/disk
mount -o loop /opt/xen/domains/vm01/diskimage /mnt/disk
debootstrap --arch i386 sarge /mnt/disk http://ftp.us.debian.org/debian
chroot /mnt/disk /bin/bash
cd /etc; vi hostname hosts resolv.conf
create fstab
/dev/sda1 / ext3 errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0
proc /proc proc defaults 0 0
logout and umount
configure Xen machine
cat > /etc/xen/vm01.cfg
kernel = "/boot/vmlinuz-2.6.12.6-xenU"
memory = 96
name = "vm01"
dhcp = "dhcp"
disk = [ 'file:/opt/xen/domains/vm01/diskimage,sd
root = "/dev/sda1 ro"
start the Xen machine
xm create vm01 -c (-c connects a console, if omitted use xm console vm01)
login as root (no password set yet)
passwd
apt-setup or base-config
apt-get update && apt-get upgrade
This is not the easiest, or even best way to do this but I've only been looking at it for about 2 hours and this is what I have so far.
UPDATE
disk = [ 'phy:/dev/hdX,hda1,w', 'phy:/dev/hdY,hda2,w' ] <-- partitions instead of files guess LVM would run in a similiar manner
REFERENCES
http://julien.danjou.info/xen.html