Instalando Xen no Debian 4

Iniciado por jniltinho, 01 de Dezembro de 2007, 13:07

tópico anterior - próximo tópico

jniltinho

Script para Criar VM no Xen usando o Debian 4


#!/bin/sh

apt-get install ntpdate less
apt-get install lvm2
apt-get install xen-linux-system-2.6.18-4-xen-686
apt-get install xen-tools




modprobe loop loop_max=255

#shutdown -r now

##Em outra partição que não esteja o sistema principal
mkdir /vserver
mkdir /vserver/vm_base
mkdir /vserver/images

dd if=/dev/zero of=/vserver/images/vm_base.img bs=1024k count=1000
dd if=/dev/zero of=/vserver/images/vm_base-swap.img bs=1024k count=500

mkfs.ext3 /vserver/images/vm_base.img
mkswap /vserver/images/vm_base-swap.img

mount -o loop /vserver/images/vm_base.img /vserver/vm_base
debootstrap --arch i386 etch /vserver/vm_base/ http://ftp2.de.debian.org/debian


chroot /vserver/vm_base
apt-setup

apt-get update

apt-get install localeconf

apt-get remove nfs-common
rm -f /etc/hostname

exit

cp -dpR /lib/modules/2.6.18-4-xen-686 /vserver/vm_base/lib/modules/
mv /vserver/vm_base/lib/tls /vserver/vm_base/lib/tls.disabled
umount /vserver/vm_base


cp -pf /vserver/images/vm_base.img /vserver/images/vm01.img
cp -pf /vserver/images/vm_base-swap.img /vserver/images/vm01-swap.img



echo 'name = "vm01"
kernel = "/boot/vmlinuz-2.6.18-4-xen-686"
root = "/dev/hda1"
memory = "128"
disk = ['file:/vserver/images/vm01.img,hda1,w','file:/vserver/images/vm01-swap.img,hda2,w']
vcpus=1
# network
vif = [ 'bridge=xenbr0', ]
on_reboot = 'restart'
on_crash = 'restart'
' > /etc/xen/vm01-config.sxp

xm create -c /etc/xen/vm01-config.sxp



Pode ser que alguma coisa saia errada, caso aconteça consulte os links abaixo:

http://caiocandido.wordpress.com/2007/08/09/xen-misterios-instalacao-via-deb/
http://caiocandido.wordpress.com/category/xen/
http://wiki.xen-br.org/index.php?title=P%C3%A1gina_principal
http://wiki.xensource.com/xenwiki/VMDKImage
http://publib.boulder.ibm.com/infocenter/eserver/v1r2/index.jsp?topic=/eica7/eica7_creating_master_image_xen_manually.htm
http://jailtime.org/howto:filesystem?do=index