Aufsetzen eines Xen-Systems bei Hetzner.
(Jan 08)

Bei Hetzner zusätzliche ips bestellen, nicht die aus dieser Webseite nehmen!


https://www.hetzner.de/robot/

im Rettungssystem starten, pwd merken ;)

"installimage" aufrufen,

Installieren des: 64bit Debian 4.0 Etch

BOOTLOADER = grub
einstellen, los gehts.

Danach im installieren system:


> apt-get install xen-linux-system-2.6.18-4-xen-amd64
> apt-get install xen-tools


hinzufügen von:
/etc/sysctl.conf:
net.ipv4.ip_forward = 1
net.ipv4.conf.all.proxy_arp = 1


Netzwerk ändern in:
/etc/xen/xend-config.sxp:
#(network-script network-bridge)
#(vif-script vif-bridge)
(vif-script vif-route)
(network-script network-route)

- bei Hetzner geht nur Routing, kein Bridge - dann
> reboot

nach restart mal kucken
> xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 3366 2 r----- 5.4


> mkdir /home/xen

xen-tools editieren:

vi /etc/xen-tools/xen-tools.conf


kommentar weg von
dir = /home/xen

Werte ändern:
size = 8Gb # Disk image size.
memory = 256Mb # Memory size
swap = 2048Mb # Swap size
# noswap = 1 # Don.t use swap at all for the new system.
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = etch # Default distribution to install.
image = sparse # Specify sparse vs. full disk images.

Werte ändern (entsprechend /boot/grub/menu.lst)
kernel = /boot/vmlinuz-2.6.18-4-xen-amd64
initrd = /boot/initrd.img-2.6.18-4-xen-amd64
mirror = http://ftp.de.debian.org/debian/

Virtuellen rechner erzeugen mit einer der zusätzlichen ips von Hetzner (ip und gateway gleich):
> xen-create-image --debootstrap -hostname vm1 -ip=78.123.123.249 -gateway=78.123.123.249 -netmask=255.255.255.248
das anhängen von -passwd veranlasst nach dem installieren das man ein pw setzen kann/muss


General Infomation
--------------------
Hostname : vm1
Distribution : etch
Fileystem Type : ext3

Size Information
----------------
Image size : 8Gb
Swap size : 2048Mb
Image type : sparse
Memory size : 256Mb
Kernel path : /boot/vmlinuz-2.6.18-4-xen-amd64
Initrd path : /boot/initrd.img-2.6.18-4-xen-amd64

Networking Information
----------------------
IP Address 1 : 78.123.123.249
Netmask : 255.255.255.248
Gateway : 78.123.123.249


Creating swap image: /home/xen/domains/vm1/swap.img
Done
Creating disk image: /home/xen/domains/vm1/disk.img
Done
Creating ext3 filesystem on /home/xen/domains/vm1/disk.img
Done
Installing your system with debootstrap mirror http://ftp.de.debian.org/debian/
Running hooks
Done
No role script specified. Skipping
Creating Xen configuration file
Done
All done
Logfile produced at:
/var/log/xen-tools/vm1.log


Starten des Rechners:
> xm create vm1.cfg
Using config file "/etc/xen/vm1.cfg".
Started domain vm1


Console aufrufen
> xm console vm1

als root einloggen, mit passwd passwort setzen.

der Rechner ist sofort zB von meinem 1und1-Server erreichbar.

runterfahren xm shutdown vm1

Fertig

Xen auf Suse bei Hetzner

----

Geschaft mit den Infos von:
http://jimmyg.org/category/virtulization/
http://www.simonfrerichs.de/2007/05/24/howto-xen-auf-debian-mit-amd64-kernel/
http://swik.net/r.i.pienaar/www.devco.net/XEN,+Bridging+and+Hetzner/bqu8m


IPMail von Hetzner

IP: 78.123.123.248
Maske: 255.255.255.248
Broadcast: 78.123.123.255

Verwendbare IP-Adressen:
78.123.123.249 bis 78.123.123.254

----

Weitere interessante Tutorials
http://www.howtoforge.com/ubuntu_7.04_xen_from_repositories
http://www.pug.org/index.php/Xen-Installation
http://www.pug.org/index.php/Xen-Installation-Seite-3#SLES10_.28SP1.29_.2F_OpenSUSE_-_Installation
http://www.trullala.de/technisches/windows-auf-xen/

----------------------
Debian-40-etch-64-minimal:~# cat /etc/xen-tools/xen-tools.conf
#
# /etc/xen-tools/xen-tools.conf
#
# Global configuration file for the scripts included with Xen-tools.
#
# Values may be set here so they don't need to be specified upon the
# command line.
#
# Steve
# --
#

#
##
# Output directory for storing loopback images.
#
# If you choose to use loopback images, which are simple to manage but
# slower than LVM partitions, then specify a directory here and uncomment
# the line.
#
# New instances will be stored in subdirectories named after their
# hostnames.
#
##
dir = /home/xen
#

#
##
#
# If you don't wish to use loopback images then you may specify an
# LVM volume group here instead
#
##
# lvm = skx-vg


#
##
#
# Installation method.
#
# There are four different methods you can use to install a new copy
# of Linux to use in your Xen guest domain:
#
# - Installation via the debootstrap command.
# - Installation via the rpmstrap command.
# - Installation by copying a directory containing a previous installation.
# - Installation by untarring a previously archived image.
#
# NOTE That if you use the "untar", or "copy" options you should ensure
# that the image you're left with matches the 'dist' setting later in
# this file.
#
# Note that you can only uncomment one method - they are mutually exclusive.
# However the command line installation method will allow you to override
# the choice you make here.
#
##
#
# copy = /path/to/pristine/image
# debootstrap = 1
# rpmstrap = 1
# tar = /path/to/img.tar
#

#
##
# Command definitions.
##
#
# The "debootstrap" and "rpmstrap" commands are hardwired, but if you
# wish to alter the commands invoked when using the "--copy" + "--tar"
# options you can adjust these two settings:
#
# --copy:
# copy-cmd = /bin/cp -a $src/* $dest
#
# --tar:
# tar-cmd = /bin/tar --numeric-owner -xvf $src
#
#

#
##
# Disk and Sizing options.
##
#

size = 8Gb # Disk image size.
memory = 256Mb # Memory size
swap = 2048Mb # Swap size
# noswap = 1 # Don.t use swap at all for the new system.
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = etch # Default distribution to install.
image = sparse # Specify sparse vs. full disk images.
#

#
# Currently supported and tested distributions include:
#
# sid - Debian
# sarge - Debian
# etch - Debian
# dapper - Ubuntu
# centos4 - CentOS 4
# fedora-core4 - Fedora Core 4 (codname stentz)
#

##
# Networking setup values.
##

#
# Uncomment and adjust these network settings if you wish to give your
# new instances static IP addresses.
#
# gateway = 192.168.1.1
# netmask = 255.255.255.0
#
# Uncomment this if you wish the images to use DHCP
#
# dhcp = 1


##
# Misc options
##

#
# Uncomment the following line if you wish to disable the caching
# of downloaded .deb files when using debootstrap to install images.
#
# cache = no
#

#
# Uncomment the following line if you wish to interactively setup
# a new root password for images.
#
# passwd = 1

#
# If you'd like all accounts on your host system which are not present
# on the guest system to be copied over then uncomment the following line.
#
# accounts = 1
#

#
# Default kernel and ramdisk to use for the virtual servers
#
kernel = /boot/vmlinuz-2.6.18-4-xen-amd64
initrd = /boot/initrd.img-2.6.18-4-xen-amd64
mirror = http://ftp.de.debian.org/debian/

#
# The architecture to use when using debootstrap or rpmstrap.
#
# This is most useful on 64 bit host machines, for other systems it
# doesn't need to be used.
#
# arch=i386
#

#
# The default mirror for debootstrap which can be used to install
# Debian Sid, Sarge, and Etch.
#
#mirror = http://ftp.us.debian.org/debian/

#
# A mirror suitable for use when installing the Dapper release of Ubuntu.
#
# mirror = http://gb.archive.ubuntu.com/ubuntu/

#
# Uncomment if you wish newly created images to boot once they've been
# created.
#
# boot = 1


------------------


Debian-40-etch-64-minimal:~# cat /etc/xen/xend-config.sxp
# -*- sh -*-

#
# Xend configuration file.
#

# This example configuration is appropriate for an installation that
# utilizes a bridged network configuration. Access to xend via http
# is disabled.

# Commented out entries show the default for that entry, unless otherwise
# specified.

#(logfile /var/log/xen/xend.log)
#(loglevel DEBUG)

#(xend-http-server no)
#(xend-unix-server no)
#(xend-tcp-xmlrpc-server no)
#(xend-unix-xmlrpc-server yes)
#(xend-relocation-server no)

#(xend-unix-path /var/lib/xend/xend-socket)

# Port xend should use for the HTTP interface, if xend-http-server is set.
#(xend-port 8000)

# Port xend should use for the relocation interface, if xend-relocation-server
# is set.
#(xend-relocation-port 8002)

# Address xend should listen on for HTTP connections, if xend-http-server is
# set.
# Specifying 'localhost' prevents remote connections.
# Specifying the empty string '' (the default) allows all connections.
#(xend-address '')
#(xend-address localhost)

# Address xend should listen on for relocation-socket connections, if
# xend-relocation-server is set.
# Meaning and default as for xend-address above.
#(xend-relocation-address '')

# The hosts allowed to talk to the relocation port. If this is empty (the
# default), then all connections are allowed (assuming that the connection
# arrives on a port and interface on which we are listening; see
# xend-relocation-port and xend-relocation-address above). Otherwise, this
# should be a space-separated sequence of regular expressions. Any host with
# a fully-qualified domain name or an IP address that matches one of these
# regular expressions will be accepted.
#
# For example:
# (xend-relocation-hosts-allow '^localhost$ ^.*\.example\.org$')
#
#(xend-relocation-hosts-allow '')

# The limit (in kilobytes) on the size of the console buffer
#(console-limit 1024)

##
# To bridge network traffic, like this:
#
# dom0: fake eth0 -> vif0.0 -+
# |
# bridge -> real eth0 -> the network
# |
# domU: fake eth0 -> vifN.0 -+
#
# use
#
# (network-script network-bridge)
#
# Your default ethernet device is used as the outgoing interface, by default.
# To use a different one (e.g. eth1) use
#
# (network-script 'network-bridge netdev=eth1')
#
# The bridge is named xenbr0, by default. To rename the bridge, use
#
# (network-script 'network-bridge bridge=<name>')
#
# It is possible to use the network-bridge script in more complicated
# scenarios, such as having two outgoing interfaces, with two bridges, and
# two fake interfaces per guest domain. To do things like this, write
# yourself a wrapper script, and call network-bridge from it, as appropriate.
#
#(network-script network-dummy)
#
(vif-script vif-route)
(network-script network-route)


# The script used to control virtual interfaces. This can be overridden on a
# per-vif basis when creating a domain or a configuring a new vif. The
# vif-bridge script is designed for use with the network-bridge script, or
# similar configurations.
#
# If you have overridden the bridge name using
# (network-script 'network-bridge bridge=<name>') then you may wish to do the
# same here. The bridge name can also be set when creating a domain or
# configuring a new vif, but a value specified here would act as a default.
#
# If you are using only one bridge, the vif-bridge script will discover that,
# so there is no need to specify it explicitly.
#
#(vif-script vif-bridge)


## Use the following if network traffic is routed, as an alternative to the
# settings for bridged networking given above.
#(network-script network-route)
#(vif-script vif-route)


## Use the following if network traffic is routed with NAT, as an alternative
# to the settings for bridged networking given above.
#(network-script network-nat)
#(vif-script vif-nat)


# Dom0 will balloon out when needed to free memory for domU.
# dom0-min-mem is the lowest memory level (in MB) dom0 will get down to.
# If dom0-min-mem=0, dom0 will never balloon out.
(dom0-min-mem 196)

# In SMP system, dom0 will use dom0-cpus # of CPUS
# If dom0-cpus = 0, dom0 will take all cpus available
(dom0-cpus 0)

# Whether to enable core-dumps when domains crash.
#(enable-dump no)

# The tool used for initiating virtual TPM migration
#(external-migration-tool '')

# The interface for VNC servers to listen on. Defaults
# to 127.0.0.1 To restore old 'listen everywhere' behaviour
# set this to 0.0.0.0
#(vnc-listen '127.0.0.1')


----------------

Debian-40-etch-64-minimal:~# 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
net.ipv4.ip_forward = 1
net.ipv4.conf.all.proxy_arp = 1


----------------

cat /etc/xen/vm1.cfg

kernel  = '/boot/vmlinuz-2.6.18-4-xen-amd64'
ramdisk = '/boot/initrd.img-2.6.18-4-xen-amd64'
memory  = '256'
root    = '/dev/sda1 ro'
disk    = [ 'file:/home/xen/domains/vm1/disk.img,sda1,w', 'file:/home/xen/domains/vm1/swap.img,sda2,w' ]
name    = 'vm1'
vif  = [ 'ip=78.123.123.249' ]
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'


Debian-40-etch-64-minimal:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
78.123.123.249   0.0.0.0         255.255.255.255 UH    0      0        0 vif1.0

Einstellungen:
vi /etc/xen/vm1.cfg

Netzwerk debian
vi /etc/network/interfaces
/etc/init.d/networking restart

apache auf debian
apt-get install apache2
/etc/init.d/apache2 restart
vi /var/www/apache2-default/index.html