Setting up Xen VPS hosting at Hetzner Debian 5.0 Lenny
Server from Hetzner has fallowing configuration:
Main IP: 188.40.22.8
NetMask: 255.255.255.192
3 IP assinged to the server: 188.40.22.9, 188.40.22.10, 188.40.22.11
1. Enable rescue mode:

2. Reset server

3. Save Password and wait around 2 minutes.
4. Now log in to server via ssh.

5. Execute installimage to start installation.

6. Select Debain 5.0 as operating system

7. Now you should have Debian 5.0 Lenny installed.

8. Reboot server
root@rescue ~ # reboot
9. Install Xen
apt-get install xen-hypervisor-3.2-1-amd64 xen-linux-system-2.6.26-2-xen-amd64 xen-utils-3.2-1 xenstore-utils xenwatch xen-shell xen-tools
10. Reboot server
# reboot
11. Yes we have xen installed
# uname -a Linux Debian-50-lenny-64-minimal 2.6.26-2-xen-amd64 #1 SMP Thu Nov 5 04:27:12 UTC 2009 x86_64 GNU/Linux
12. Enable Xen routed networking
# nano /etc/xen/xend-config.sxp
comment out:
#(network-script network-bridge) #(network-script network-dummy) #(vif-script vif-bridge)
and add fallowing lines:
(network-script 'network-route netdev=eth0') (vif-script vif-route)
Save file and restart xend:
# /etc/init.d/xend restart
13. /etc/sysctl.conf should match this results.
# cat /etc/sysctl.conf
### Hetzner Online AG installimage # sysctl config net.ipv4.ip_forward=1 net.ipv4.conf.all.rp_filter=1 net.ipv4.icmp_echo_ignore_broadcasts=1
Apply new changed by executing command:
# sysctl -p
net.ipv4.ip_forward = 1 net.ipv4.conf.all.rp_filter = 1 net.ipv4.icmp_echo_ignore_broadcasts = 1
14. We are not using LVM just simple image based VM with ext3. So we need increase loop.
# nano /etc/modules
# /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. # Parameters can be specified after the module name. loop max_loop=64
15. Great! We have everything ready to run first VPS. We will use xen-tools to create first VPS.
For new VM instance we need IP, NetMask and Gateway.
IP: 188.40.22.9
NetMask: 255.255.255.192
Gateway: 188.40.22.8
Please note Gateway for all VPSes is main IP assigned from Hetzner. In this case 188.40.22.8.
# xen-create-image --hostname=test --size=3Gb --swap=256Mb --ide --ip=188.40.22.9 --netmask=255.255.255.192 --gateway=188.40.22.8 --dir=/xen --memory=512M --kernel=/boot/vmlinuz-2.6.26-2-xen-amd64 --initrd=/boot/initrd.img-2.6.26-2-xen-amd64 --debootstrap --dist=lenny --mirror=http://ftp2.de.debian.org/debian/ --passwd
General Information
--------------------
Hostname : test
Distribution : lenny
Partitions : swap 256Mb (swap)
/ 3Gb (ext3)
Image type : sparse
Memory size : 512M
Kernel path : /boot/vmlinuz-2.6.26-2-xen-amd64
Initrd path : /boot/initrd.img-2.6.26-2-xen-amd64
Networking Information
----------------------
IP Address 1 : 188.40.22.9 [MAC: 00:16:3E:79:13:F3]
Netmask : 255.255.255.192
Gateway : 188.40.22.8
Creating partition image: /xen/domains/test/swap.img
Done
Creating swap on /xen/domains/test/swap.img
Done
Creating partition image: /xen/domains/test/disk.img
Done
Creating ext3 filesystem on /xen/domains/test/disk.img
Done
Installation method: debootstrap
Done
Running hooks
Done
No role scripts were specified. Skipping
Creating Xen configuration file
Done
Setting up root password
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
All done
Logfile produced at:
/var/log/xen-tools/test.log
16. Edit VM’s configuration and addional line
extra = 'console=hvc0 xencons=tty'
# nano /etc/xen/test.cfg
#
# Configuration file for the Xen instance test, created
# by xen-tools 3.9 on Sat Jan 9 18:31:35 2010.
#
#
# Kernel + memory size
#
kernel = '/boot/vmlinuz-2.6.26-2-xen-amd64'
ramdisk = '/boot/initrd.img-2.6.26-2-xen-amd64'
memory = '512'
#
# Disk device(s).
#
root = '/dev/hda2 ro'
disk = [
'file:/xen/domains/test/swap.img,hda1,w',
'file:/xen/domains/test/disk.img,hda2,w',
]
#
# Hostname
#
name = 'test'
#
# Networking
#
vif = [ 'ip=188.40.22.8,mac=00:16:3E:79:13:F3' ]
#
# Behaviour
#
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
extra = 'console=hvc0 xencons=tty'
17. Start new VM
# xm create /etc/xen/test.cfg
Using config file "/etc/xen/test.cfg". Started domain test
Error:
/etc/init.d/xend restart
Restarting XEN control daemon: xend/etc/xen/scripts/network-route: line 27: /proc/sys/net/ipv4/conf/eth/proxy_arp: No such file or directory /etc/xen/scripts/network-route: line 27: /proc/sys/net/ipv4/conf/eth/proxy_arp: No such file or directory /etc/xen/scripts/network-route: line 27: /proc/sys/net/ipv4/conf/eth/proxy_arp: No such file or directory /etc/xen/scripts/network-route: line 27: /proc/sys/net/ipv4/conf/eth/proxy_arp: No such file or directory /etc/xen/scripts/network-route: line 27: /proc/sys/net/ipv4/conf/eth/proxy_arp: No such file or directory
Solution
This solution pertain to Xen 3.2.x
With new version of Xen you need specify the network device (netdev) in configuration file (/etc/xen/xend-config.sxp)
(network-script 'network-route netdev=eth0') (vif-script vif-route)
Error:
Server refused to allocate pty stdin: is not a tty
Solution
xm create /etx/xen/test.cfg xm console test apt-get install udev
Additonaly you can add line to /etc/fstab in DomU
none /dev/pts devpts gid=5,mode=620 0 0
Don’t forget to restart DomU.
reboot