[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Installing Xen 4.0 on Debian 6



Le 29/03/2011 21:56, Erwan RENIER a écrit :
Le 29/03/2011 10:12, Peter LindstrXXm a écrit :

Hi all!

I'm looking for a working tutorial on how to install Xen 4.0 on Debian 6. I've googled and found several ones that didn't work 100%. So my hope goes to you guys.

Sincerely,
Peter

well, it's pretty straight forward as i remember :

The easiest way is to install xen-linux-system-2.6-xen-amd64 with apt ( i suppose you're on a 64 kernel version )

It will install all the needed packages.

Seems not finaly , here's the complete list if needed :

apt-get install libxenstore3.0 linux-image-2.6.32-5-xen-amd64 xen-hypervisor-4.0-amd64 xen-linux-system-2.6-xen-amd64 xen-linux-system-2.6.32-5-xen-amd64 xen-qemu-dm-4.0 xen-utils-4.0 xen-utils-common xenstore-utils xenwatch

Edit /etc/xen/xend-config.sxp :
uncomment this line if you want to bridge your DomUs on the host :
# (network-script network-bridge)
uncomment/add this line if you want to use vnc without password by default :
(vncpasswd '')
ignore the line wich say the bridge will be named xenbr0, it's not true anymore, it now rename the interface eth0 in peth0 and create a bridge named eth0
Reboot... tada!
:)

here's a sample from grub.cfg ( grub2 ) :

menuentry 'Debian GNU/Linux, with Linux 2.6.38-rc8-konradxen+ and XEN 4.0.2-rc3-pre' --class debian --class gnu-linux --class gnu --class os --class xen {
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos5)'
        search --no-floppy --fs-uuid --set 6149b0be-4294-49c5-871f-7195a3333cc8
        echo    'Chargement de Linux 2.6.38-rc8-konradxen+ ...'
        multiboot       /xen-4.0.2-rc3-pre.gz placeholder dom0_max_vcpus=1 dom0_vcpus_pin
        module  /vmlinuz-2.6.38-rc8-konradxen+ placeholder root=/dev/mapper/vg0-root ro  quiet
        echo    'Chargement du disque mémoire initial ...'
        module  /initrd.img-2.6.38-rc8-konradxen+
}

verify it works by typing :
xentop

if it don't :

ls /proc/xen/
you should see :
capabilities  privcmd  xenbus
if not : add this line in /etc/fstab :
xenfs           /proc/xen       xenfs   defaults        0       1
and execute
mount -a

if /dev/xen/evtchn doesn't exists add this line in /etc/modules
xen-evtchn
and execute
modprobe xen-evtchn

if there's no process xend
udate-rc.d xend defaults
/etc/init.d/xend/start

For DomUs : well it depends on  what kind of DomU you want.

I didn't use a manager to create DomUs, but directly made the config files ( you have to put them in /etc/xen ).
Here's two example :

pvops : /etc/xen/p2p.cfg

name = "p2p"
kernel =  "vmlinuz-2.6.38-rc6-lio"
ramdisk = "initrd.img-2.6.38-rc6-lio"
root = "/dev/mapper/pvops-root"
memory = "512"
#disk = [ 'phy:vg0/p2p,sda,w' , 'phy:/dev/loop0,ioemu:hdc:cdrom,r' ]
disk = [ 'phy:vg0/p2p,xvda,w' , 'phy:vg0/mmd,xvdb1,w' ]
#boot = 'c'
vif = [ 'bridge=eth0' ]
vfb = [ 'type=vnc,vnclisten=0.0.0.0' ]
keymap = 'fr'
serial = 'pty'
vcpus = 2

      

      
full virtualized host ( the same DomU ) :

name = "p2p"
kernel = '/usr/lib/xen/boot/hvmloader'
builder = 'hvm'
device_model = '/usr/lib/xen-4.0/bin/qemu-dm'
memory = "512"
#disk = [ 'phy:vg0/p2p,xvda,w' , 'phy:/dev/loop0,ioemu:hdc:cdrom,r' ] 
disk = [ 'phy:vg0/p2p,xvda,w' , 'phy:vg0/mmd,xvdb1,w' ]
boot = 'c'
vif = [ 'bridge=eth0' ]
vfb = [ 'type=vnc,vnclisten=0.0.0.0' ]
keymap = 'fr'
serial = 'pty'
vcpus = 2

      

      
If you want to install from an iso :

mount the iso on a loop device :
losetup /dev/loop0 /root/debian-sq-di-rc1-amd64-netinst.iso
add it to your config file (the commented line )
change boot='c' to by boot='d'
after the install remove it from the config and unmount it :
losetup -d /dev/loop0

to launch a vm :
xm create p2p.cfg
to hard stop it ( better to halt in the guest ) :
xm destroy p2p.cfg

Note for pvops :

You have to use a xen kernel and initrd that you put in /boot of Dom0 ( you can use the one from Dom0 too )
You just have to copy /lib/modules/<kernel-version> into the guest
As you can see i used lvm for disk devices the full path is /dev/vg0/p2p, you can remove /dev for devices ( i m not sure it's mandatory )
if you want to connect to the console change this line in inittab :
    1:2345:respawn:/sbin/getty 38400 tty1
by
   1:2345:respawn:/sbin/getty 38400 hvc0
you will be able to see wat's hapenning by using '-c' option on boot or 'xm console p2p' after


if you want to make lvm or partitions in the guest :

create a dos table and the partitions :
fdisk -l /dev/vg0/p2p
       Device Boot          Start          End       Blocks      Id   System
/dev/vg0/p2p1               1            61        487424     82  Linux swap / Solaris
/dev/vg0/p2p2   *          61          1045     7899136   8e  Linux LVM

if you want to use debootstrap to install on those partitions :

here we use losetup again :
rmmod loop
modprobe loop max_part=63
losetup /dev/loop0 /dev/vg0/p2p

you will now have :
/dev/loop0p1
/dev/loop0p2

pvcreate /dev/loop0p2
vgcreate pvops /dev/loop0p2
vgscan
vgchange -ay ( maybe unecessary the first time because there no lv yet )

create your logical volumes and mount your logical volumes for use with debootstrap
exemple :
mount /dev/pvops/root /mnt/chroot
cd /mnt/chroot
mkdir usr var dev proc home tmp sys
mount /dev/pvops/var /mnt/chroot/var
mount /dev/pvops/usr /mnt/chroot/usr
mount /dev/pvops/home /mnt/chroot/home
mount /dev/pvops/tmp /mnt/chroot/tmp
mount -o bind /proc /mnt/chroot/proc
mount -o bind /dev /mount/chroot/dev
mount -o bind /dev/pts /mount/chroot/dev/pts
mount -o bind /dev/shm /mount/chroot/dev/pts
mount -o bind /sys /mount/chroot/sys 

install with debootstrap ( see manual/howto )
cp -rp /lib/modules/<kernel-version> /mnt/chroot/lib/modules/<kernel-version>
chroot /mnt/chroot
configure :
/etc/network/interfaces
/etc/fstab
/etc/hosts
/etc/resolv.conf
/etc/hostname
/etc/inittab ( for hvc0 )

exit
umount all your partitions
vgchange -an pvops
losetup -d /dev/loop0

and boot the vm :
cd /etc/xen
xm create p2p.cfg -c


Note for full virtualized host :

You must have a complete working system on the guest filesystem ( kernel, grub, etc, ... )

Note for both :

the disk devices created appears as xvda ,xvdb, etc
you can add a filesystem as a partition if you want : ( see xvdb1 in the config )

if you use vnc it will increment the port from 9001 as you add VMs, you connect to it by using Dom0 IP
you call also use the extra options vncdisplay=10 ( for port 9010 )

you can set a vnc password for a specific vm : vncpasswd=idontknow
full exemple :
vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncdisplay=10,vncpasswd=idontknow' ]
if you want to mount the same fs in different DomUs ( for clustered filesystems ) add '!' in the config : 'phy:vg0/mmd,xvdb1,w!'

The end.

I thought it was short...


_______________________________________________ Xen-users mailing list Xen-users@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-users

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.