Diferencia entre revisiones de «Xen»
(→Installation) |
(→Debian Lenny installation) |
||
(No se muestran 8 ediciones intermedias del mismo usuario) | |||
Línea 6: | Línea 6: | ||
;AMD | ;AMD | ||
− | sudo apt-get install linux-image-2.6-xen- | + | sudo apt-get install linux-image-2.6.18-6-xen-686 xen-hypervisor-3.0.3-1-i386-pae xen-linux-system-2.6.18-6-xen-686 libc6-xen bridge-utils |
Optional packages: | Optional packages: | ||
Línea 12: | Línea 12: | ||
*xen-shell | *xen-shell | ||
− | + | ==Network config== | |
+ | |||
Before the reboot, a small change in /etc/xen/xend-config.sxp should be done. | Before the reboot, a small change in /etc/xen/xend-config.sxp should be done. | ||
Replace | Replace | ||
+ | (network-script network-dummy) | ||
− | (network-script network- | + | === bridge === |
+ | (network-script 'network-bridge netdev=eth0') | ||
+ | |||
+ | === NAT === | ||
+ | <pre> | ||
+ | (network-script network-nat) | ||
+ | (vif-script vif-nat) | ||
+ | </pre> | ||
+ | |||
+ | Create /etc/network/if-up.d/iptables for port forwarding | ||
+ | iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 80 -j DNAT --to 10.0.1.1:80 | ||
− | + | chmod 755 /etc/network/if-up.d/iptables | |
− | |||
+ | If dom0 public interface is different to "eth0" change defaults in /etc/xen/scripts/* | ||
;reboot | ;reboot | ||
− | + | ==xen-tools== | |
− | |||
;(optional) to install latests version from project repository add to sources.lists | ;(optional) to install latests version from project repository add to sources.lists | ||
# | # | ||
Línea 57: | Línea 68: | ||
== Debian Lenny installation == | == Debian Lenny installation == | ||
− | sudo apt-get install linux- | + | sudo apt-get install xen-linux-system-2.6.26-2-xen-686 xen-tools |
=Administration= | =Administration= | ||
Línea 109: | Línea 120: | ||
happy with the xen packages from Debian 4.0 so i can setup a whole bunch of | happy with the xen packages from Debian 4.0 so i can setup a whole bunch of | ||
dom0s in a very short time. | dom0s in a very short time. | ||
+ | |||
+ | |||
+ | = Migrating CentOS VM from VMWare to Xen on a Debian Etch Dom0 = | ||
+ | |||
+ | On VMWare VM create a tar file | ||
+ | cd / | ||
+ | tar zcpf project-open.tgz --exclude=boot --exclude=proc --exclude=tmp/* --exclude=sys --exclude=var/cache/open | ||
+ | |||
+ | Copy tar file from VMWare to XEN LVM Logical Volume and expand it | ||
+ | cd /mnt/tmp | ||
+ | tar zxpf /tmp/project-open.tgz | ||
+ | |||
+ | Prepare de VM | ||
+ | cp -r /lib/modules/2.6.18-6-xen-686 /mnt/tmp/lib/modules/ | ||
+ | mkdir -p /mnt/tmp/tmp /mnt/tmp/proc /mnt/tmp/sys | ||
+ | |||
+ | * Copy /boot from another VM | ||
+ | * Change devices in /etc/fstab | ||
+ | |||
+ | Remove VMWare tools: | ||
+ | rm /etc/rc5.d/S19vmware-tools | ||
+ | |||
+ | Fix "4gb seg fixup" error | ||
+ | echo "hwcap 0 nosegneg" > /etc/ld.so.conf.d/nosegneg.conf | ||
+ | ldconfig | ||
+ | |||
+ | |||
+ | '''References''' | ||
+ | * http://wiki.centos.org/HowTos/Xen/MoveNative2DomU | ||
+ | * http://www.sit.auckland.ac.nz/VM_migration_from_VMWare_to_Xen | ||
=Common problems= | =Common problems= | ||
Línea 154: | Línea 195: | ||
**[http://www.debian-administration.org/articles/533 A brief introduction to xen-tools] | **[http://www.debian-administration.org/articles/533 A brief introduction to xen-tools] | ||
*http://xenman.sourceforge.net/ | *http://xenman.sourceforge.net/ | ||
+ | *http://www.enomaly.com | ||
=Images= | =Images= |
Revisión actual del 12:06 6 may 2009
Contenido
Installation
Debian Etch installation
Packages install
- INTEL
sudo apt-get install linux-image-2.6.18-6-xen-686 xen-hypervisor-3.0.3-1-i386-pae xen-linux-system-2.6.18-6-xen-686 libc6-xen bridge-utils
- AMD
sudo apt-get install linux-image-2.6.18-6-xen-686 xen-hypervisor-3.0.3-1-i386-pae xen-linux-system-2.6.18-6-xen-686 libc6-xen bridge-utils
Optional packages:
- xen-docs-3.0
- xen-shell
Network config
Before the reboot, a small change in /etc/xen/xend-config.sxp should be done.
Replace
(network-script network-dummy)
bridge
(network-script 'network-bridge netdev=eth0')
NAT
(network-script network-nat) (vif-script vif-nat)
Create /etc/network/if-up.d/iptables for port forwarding
iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 80 -j DNAT --to 10.0.1.1:80
chmod 755 /etc/network/if-up.d/iptables
If dom0 public interface is different to "eth0" change defaults in /etc/xen/scripts/*
- reboot
xen-tools
- (optional) to install latests version from project repository add to sources.lists
# # Steve Kemp's repository: Etch # deb http://apt.steve.org.uk/etch etch main non-free contrib deb-src http://apt.steve.org.uk/etch etch main non-free contrib
sudo apt-get install xen-tools
- xen-tools config
in /etc/xen-tools/xen-tools.conf
lvm = vg0 debootstrap = 1 size = 10Gb # Disk image size. memory = 256Mb # Memory size swap = 256Mb # Swap size fs = ext3 # use the EXT3 filesystem for the disk image. dist = etch # Default distribution to install. image = sparse # Specify sparse vs. full disk images. dhcp = 1 kernel = /boot/vmlinuz-2.6.18-5-xen-amd64 initrd = /boot/initrd.img-2.6.18-5-xen-amd64 mirror = http://ftp.us.debian.org/debian/
Debian Lenny installation
sudo apt-get install xen-linux-system-2.6.26-2-xen-686 xen-tools
Administration
Create image
xen-create-image --hostname vserver1.mydomain
- or use with options
xen-create-image --hostname=vm1.domain.com --size=5Gb --swap=256Mb --ide \ --ip=192.168.0.101 --netmask=255.255.255.0 --gateway=192.168.0.1 --force \ --dir=/vserver --memory=32Mb --arch=i386 --kernel=/boot/vmlinuz-2.6.18-xenU \ --debootstrap --dist=etch --mirror=http://ftp2.de.debian.org/debian/ --passwd
Boot
xm create /etc/xen/vserver1.mydomain.cfg
Console connect
xm console vserver1.mydomain
Other common commands
xm shutdown <name> - Stop a virtual machine. xm destroy <name> - Stop a virtual machine immediately without shutting it down. It's as if you switch off the power button. xm list - List all running systems. xm help - List of all commands.
dom0 memory
you have to limit dom0 memory on two places, xen hypervisor option and xend config. In this example below I limit memory to 256MB:
/boot/grub/menu.lst
87c87 < # xenhopt= --- > # xenhopt=dom0_mem=256M
/etc/xen/xend-config.sxp
120c120 < (dom0-min-mem 196) --- > (dom0-min-mem 256)
After changing /boot/grub/menu.lst you have to run update-grub and reboot the machine. After changing /etc/xen/xend-config.sxp you have to restart xend with /etc/init.d/xend restart.
With this I have no more problems with my netback driver on my ~10 dom0s running plain Debian 4.0. (My biggest machine has a uptime of over 45 days and handles ~20 domUs. Also a lot of live migration are happening to and from this host.) So for me this bug doesn't "renders package unusable". I'm very happy with the xen packages from Debian 4.0 so i can setup a whole bunch of dom0s in a very short time.
Migrating CentOS VM from VMWare to Xen on a Debian Etch Dom0
On VMWare VM create a tar file
cd / tar zcpf project-open.tgz --exclude=boot --exclude=proc --exclude=tmp/* --exclude=sys --exclude=var/cache/open
Copy tar file from VMWare to XEN LVM Logical Volume and expand it
cd /mnt/tmp tar zxpf /tmp/project-open.tgz
Prepare de VM
cp -r /lib/modules/2.6.18-6-xen-686 /mnt/tmp/lib/modules/ mkdir -p /mnt/tmp/tmp /mnt/tmp/proc /mnt/tmp/sys
* Copy /boot from another VM * Change devices in /etc/fstab
Remove VMWare tools:
rm /etc/rc5.d/S19vmware-tools
Fix "4gb seg fixup" error
echo "hwcap 0 nosegneg" > /etc/ld.so.conf.d/nosegneg.conf ldconfig
References
* http://wiki.centos.org/HowTos/Xen/MoveNative2DomU * http://www.sit.auckland.ac.nz/VM_migration_from_VMWare_to_Xen
Common problems
To fix up "4gb seg fixup"
- on sarge and olds domU's
mv /lib/tls /lib/tls.disabled
- for etch try with
apt-get install libc6-xen
Error: Device 0 (vif) could not be connected
- If you get the following error when trying to create a domU:
Error: Device 0 (vif) could not be connected. Backend device not found.
and your /var/log/xen/xend-debug.log shows something complaining about brctl, like that:
/etc/xen/scripts/network-bridge: line 114: brctl: command not found
it seems that bridge-utils package is not installed in your host, so:
apt-get install bridge-utils /etc/init.d/xend restart
should solve the problem.
Thanks to: http://www.dit.upm.es/vnumlwiki/index.php/Xen-test-debian
Cannot open master side of pty
Cannot open master side of pty: No existe el fichero o el directorio (2) Cannot open master side of pty: No such file or directory (2)
to resolve do:
- Add to /etc/fstab the following line
none /dev/pts devpts mode=0620 0 0
- Mount it
mkdir /dev/pts mount /dev/pts