Merge remote-tracking branch 'origin/github/pr/45'
[grml.org.git] / xen / xen-in-20minutes.txt
1 Setup Xen within 20 minutes on Debian/grml
2 ==========================================
3
4 Install relevant software und update grub's menu.lst:
5
6 apt-get install linux-image-2.6.18-1-xen-686 xen-hypervisor-3.0.3-1-i386 xen-utils-3.0.3-1 xen-tools
7 update-grub
8
9 Example for installation of Debian etch as DomU:
10
11 mkdir /mnt/md1/xen
12 xen-create-image --debootstrap --dir=/mnt/md1/xen --size=2Gb --memory=512Mb --fs=ext3 \
13   --cache=yes --dist=etch --hostname=xengrml1 --ip 192.168.1.2 --netmask 255.255.255.0 \
14   --gateway 192.168.1.1 --initrd=/boot/initrd.img-2.6.18-1-xen-686 \
15   --kernel=/boot/vmlinuz-2.6.18-1-xen-686 --mirror=http://ftp.at.debian.org/debian/
16
17 Start services:
18
19 /etc/init.d/xend start
20 /etc/init.d/xendomains start
21
22 Setup a bridge for network, either manually:
23
24 brctl addbr xenintbr
25 brctl stp xenintbr off
26 brctl sethello xenintbr 0
27 brctl setfd xenintbr 0
28 ifconfig xenintbr 192.168.1.1 netmask 255.255.255.0 up
29
30 or via /etc/network/interfaces (run 'ifup xenintbr' to bring up the device without rebooting):
31
32 auto xenintbr
33 iface xenintbr inet static
34   pre-up brctl addbr xenintbr
35   post-down brctl delbr xenintbr
36   address 192.168.1.1
37   netmask 255.255.255.0
38   bridge_fd 0
39   bridge_hello 0
40   bridge_stp off
41
42 Setup forwarding (adjust $PUBLIC_IP):
43
44 echo "1" > /proc/sys/net/ipv4/ip_forward
45 iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j SNAT --to $PUBLIC_IP
46 iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to $PUBLIC_IP
47
48 Adjust network configuration of Xend:
49
50 cat >> /etc/xen/xend-config.sxp << EOF
51 (network-script    network-route)
52 (vif-bridge        xenintbr)
53 (vif-script        vif-bridge)
54 EOF
55
56 List domains, start up a DomU, shutdown later again:
57
58 xm create -c /etc/xen/xengrml1.cfg
59 xm list
60 xm shutdown 1
61
62 Useful Ressources:
63
64 * http://www.cl.cam.ac.uk/research/srg/netos/xen/readmes/user/user.html [Users' Manual Xen v3.0]
65 * http://www.pug.org/index.php/Xen-Installation (german)
66 * http://www.debian-administration.org/articles/304 [Installing Xen 3.0 upon Debian Sarge]