Here is a very quick overview of what I did a while back.
I'm no Xen expert and I used the testing environment which I do NOT recommend. You're better off looking for good documentation but here it is all the same:
Install
Code:
# apt-get -V install linux-image-2.6-xen-686 xen-hypervisor-3.2-1-i386 xen-utils-3.2-1 xen-tools bridge-utils libc6-xen lvm2 vim -t testing
Change Xen to NAT
Change from bridged
Code:
# grep -v ^# /etc/xen/xend-config.sxp |grep ..
(network-script network-dummy)
(vif-script vif-bridge)
(dom0-min-mem 196)
(dom0-cpus 0)
(vncpasswd '')
to Natted
Code:
# grep -v ^# /etc/xen/xend-config.sxp |grep ..
(network-script network-nat)
(vif-script vif-nat)
(dom0-min-mem 196)
(dom0-cpus 0)
(vncpasswd '')
Code:
# /etc/init.d/xend restart
Create a domU
The simplest way I have found to do this is using xen-create-image
Prepare LVM
Partition your disk so that you can assign partitions to LVM. I tend to make partitions of 20G to 50G to have a bit of flexibility.
Code:
# fdisk -l
Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000ac992
Device Boot Start End Blocks Id System
/dev/sda1 * 1 637 5116671 83 Linux
/dev/sda2 638 892 2048287+ 82 Linux swap / Solaris
/dev/sda3 893 30401 237031042+ 5 Extended
/dev/sda5 893 3325 19543041 83 Linux
/dev/sda6 3326 5758 19543041 83 Linux
/dev/sda7 5759 8191 19543041 83 Linux
/dev/sda8 8192 14271 48837568+ 83 Linux
Code:
# pvcreate /dev/sda5 /dev/sda6
Physical volume "/dev/sda5" successfully created
Physical volume "/dev/sda6" successfully created
Code:
# vgcreate vm /dev/sda5 /dev/sda6
Volume group "vm" successfully created
Code:
# vgdisplay
--- Volume group ---
VG Name vm
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 37.27 GB
PE Size 4.00 MB
Total PE 9542
Alloc PE / Size 0 / 0
Free PE / Size 9542 / 37.27 GB
VG UUID Tdmir3-SIS9-BB5y-lbpA-tpDL-qXcL-J4HvvO
Create a domU
Before launching the command, you might want to add a couple of files and dirs in /etc/xen-tools/skel/ so that they can be added to you installation. Things like /etc/apt, /etc/resolv.conf, ...
Code:
# xen-create-image --debootstrap --cache=yes --lvm=vm --size=10Gb --memory=512MB --swap=1Gb --fs=ext3 --arch=amd64 --dist=etch --accounts --passwd --cache=yes --hostname=my.domain.com \
--ip=10.0.0.1 --initrd=/boot/initrd.img-2.6.18-6-xen-amd64 --kernel=/boot/vmlinuz-2.6.18-6-xen-amd64 --mirror http://ftp.debian.skynet.be/ftp/debian
Now we can check the configuration file before starting domU. You might want to make some changes. I noted that if I only specify an IP in the range 10.0.0.0/24 NATing works.
I have added my network preferences in skel so I will need to mount the newly created LV and change the IP address.