Koozali.org: home of the SME Server

HowTO: Sme 7.2 as DomU under DebianEtch Xen3.1

Offline tec

  • **
  • 48
  • +0/-0
HowTO: Sme 7.2 as DomU under DebianEtch Xen3.1
« on: October 10, 2007, 07:28:23 PM »
Hi there this is my english tranlation of the my Howto in the German Forum: http://forums.contribs.org/index.php?topic=38759.0
As I am a Linux beginner there are maybe some places where things would be done more efficient. So feel free and give me Feedback and I willupdate it.

First you need an working Xen 3.1. For german users the easiest way to get this was the DVD-Release from the german computer magazine CT. Maybe in some weeks there will be under this Url an Iso Download: http://www.heise.de/ct/projekte/machmit/ctserver/roadmap
All this instructions are based on Debian and require for the HVM Part an Processor with Vanderpool oder Pacifica Technology

ServerIP: 192.168.0.252
ServerName: xebian
volumegroup: xebian

Dom0-Debian:
apt-get update
apt-get install xen-ioemu xen-tools pciutils

touch /etc/xen/smeserver
touch /etc/xen/sme
Create Directory where to put every IsoImage
mkdir /mnt/isos
copy the SME 7.2 Iso into this directory and name it: smeserver-7.2-i386.iso
Now edit the Xen config
pico /etc/xen/xend-config.sxp

and change the following line from: #(vnc-listen '127.0.0.1')
to (vnc-listen '192.168.0.251')

now restart xen : /etc/init.d/xend restart

Next make an LVM for HVM install, more then 10G is not necassery because late we will copy the files: lvcreate -L 10G -n smeserver xebian

Now make the HVM configuration: pico /etc/xen/smeserver
and paste the following inside this:
pico /etc/xen/smeserver und folgendes reinkopieren
path='/usr/lib/xen-3.1.0-1'
kernel = path+'/boot/hvmloader'
builder='hvm'
memory = '512'
name = 'smeserver'
device_model = path+'/bin/qemu-dm'
# boot on floppy (a), hard disk (c) or CD-ROM (d)
boot='d'
disk = [ 'phy:/dev/xebian/smeserver,hda,w',
'file:/mnt/isos/smeserver-7.2-i386.iso,hdc:cdrom,r' ]
vnc=1
vncviewer=0
vncpasswd='smeserver'
vif=['bridge=intern']
on_poweroff = 'destroy'
on_reboot   = 'destroy'
on_crash    = 'destroy'

Now you can start this machine with: xm create smeserver
To verify that it is running: xm list smeserver --long |grep host
Now connect with vnc to the Ip Adress 192.168.0.251 an use as password smeserver

HVM-DomU:
install smeserver with the options: noraid nolvm <<<you will see the reason for this at *****

after finishing installation change from boot='d' to boot='c':
pico /etc/xen/smeserver

Now reboot with xm create smeserver and connect with VNC: when asked to choose as passwort try a simple one because I had some problems with special chars. Do a yum update and reboot, now install Xen Kernel
yum install kernel-xenU
and shutdown

Dom0:
Build new LVM for your Server and format them feel free to choose the sizes according to your needs.
lvcreate -n sme_lv_boot -L 200M xebian
lvcreate -n sme_lv_root -L 60GB xebian
lvcreate -n sme_lv_swap -L 2GB xebian

mkfs -t ext3 /dev/xebian/sme_lv_boot
mkfs -t ext3 /dev/xebian/sme_lv_root
mkswap /dev/xebian/sme_lv_swap

mkdir /temp
Copy the Boot partition from HVM-Machine to your new created LVM.
/usr/lib/xen-3.1.0-1/bin/lomount -diskimage /dev/xebian/smeserver -partition 1 /mnt/temp/
mount /dev/xebian/sme_lv_boot /opt
Copy with mc evertything from /mnt/temp/ to /opt
Copy Sme-Xen Kernel in Dom0
Datein rüberkopieren
mkdir -p /var/lib/xen/smeserver
cd /var/lib/xen/smeserver
cp /mnt/temp/initrd-2.6.9-55.0.9.ELxenU.img /mnt/temp/vmlinuz-2.6.9-55.0.9.ELxenU /var/lib/xen/smeserver/

umount /mnt/temp

Copy the root partition from HVM-Machine to your new created LVM:
***** when I installed the SME only with noraid I got an error here, maybe someone could provide further instructions.
/usr/lib/xen-3.1.0-1/bin/lomount -diskimage /dev/xebian/smeserver -partition 2 /mnt/temp/
Copy with mc evertything from /mnt/temp/ to /opt
umount /mnt/temp

Now create an paravirtualized Machine
pico /etc/xen/sme
#sme server domu xen
path='/var/lib/xen/smeserver/'
kernel=path+'vmlinuz-2.6.9-55.0.9.ELxenU'
ramdisk=path+'initrd-2.6.9-55.0.9.ELxenU.img'
#ramdisk=path+'initrd.img'
memory = '264'
name = 'sme'
vif = ['bridge=intern']
#disk=['phy:/dev/server/smeserver,hda1,w']
#disk = [ 'phy:/dev/xebian/smeserver,hda,w']
disk=['phy:/dev/xebian/sme_lv_swap,hda3,w',
'phy:/dev/xebian/sme_lv_root,hda2,w',
'phy:/dev/xebian/sme_lv_boot,hda1,w' ]
extra='ro root=/dev/hda2'

Boot your smeserver with console: xm create sme -c
you will get an error!
Solution for this is:
/usr/lib/xen-3.1.0-1/bin/lomount -diskimage /dev/xebian/smeserver -partition 2 /mnt/temp/
chroot /mnt/temp
You will get some error messages, maybe some could clarify them
mkinitrd --with=xenblk --with=xennet /tmp/initrd.img 2.6.9-55.0.9.ELxenU
How do I exit from the chroot? I closed the ssh session reopend it

Now copy the newly created initrd
/usr/lib/xen-3.1.0-1/bin/lomount -diskimage /dev/xebian/smeserver -partition 2 /mnt/temp/
cp /mnt/temp/tmp/initrd.img /var/lib/xen/smeserver/
and change in /etc/xen/smeserver the part with initrd:
make a comment on the first initrd row and uncomment the second initrd row

Now restart the sme machine: xm create sme -c
You will get a further error message that it cannot find the root and boot label
e2label /dev/hda2 /
e2label /dev/hda1 /boot

Now you should be able to run your SME Server:
Feel free to modify your DomU config, mine looks right now like this:
#sme server domu xen
path='/var/lib/xen/smeserver/'
kernel=path+'vmlinuz-2.6.9-55.0.9.ELxenU'
#ramdisk=path+'initrd-2.6.9-55.0.9.ELxenU.img'
ramdisk=path+'initrd.img'
memory = '264'
name = 'sme'
vif = ['mac=00:16:3E:3B:38:E6,bridge=intern'  #this change is in generall necessary for Linux Distris that use udev, without this a new mac will be generated on every start of your Domu
disk=['phy:/dev/xebian/sme_lv_swap,hda3,w',
'phy:/dev/xebian/sme_lv_root,hda2,w',
'phy:/dev/xebian/sme_lv_boot,hda1,w' ]
extra='ro root=/dev/hda2'

#If you have additional CPU or DUal COres put these Lines into it:
cpus="0-1"
vcpus = 2

on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'
#This line is when you want to have an PCI device only in your DomU. Should be usefull for DVB-Cards for the MYTH-TV Fraktion or the for HFC-Cards for the Asterisk Users
pci= [ '0000:01:05.2']

You get the PCI-ID from a device with lspci
For Pcibackhide you also need to edit in your Dom0 the menu.lst and append the following:
pico /boot/grub/menu.lst
module          /vmlinuz-...  root=/dev/mapper/xebian-root ro BOO console=tty0 pciback.hide=(01:05.2)

now reboot your Dom0 and do a dmesg |grep pciback:
you should get the following line: pciback 0000:01:05.2: seizing device

Now start your DomU and do again a dmesg |grep pciback in your Dom0, you will notice the ollowing line:
pciback: vpci: 0000:01:05.2: assign to virtual slot 0

Right now i get the following error under SME in my DomU when i try lspci:
pcilib: Cannot open /proc/bus/pci
Maybe someone could help with this

If you want that your Dom0 uses only 128MB of your Ram edit ther kernel line in your menu.lst:
kernel          /xen-3.1.0-1-i386-pae.gz vga=text-80x25 dom0_mem=128M


Hope this will help someone,
Regards Marco

P.S maybe this could end somehow in the Wiki it some users find it usefull :-)


« Last Edit: October 10, 2007, 07:32:55 PM by tec »

Offline slords

  • ****
  • 235
  • +3/-0
Re: HowTO: Sme 7.2 as DomU under DebianEtch Xen3.1
« Reply #1 on: October 10, 2007, 09:56:37 PM »
If you have a RHEL5/CentOS5 box you can also do this which is a whole lot easier and quicker:

virt-install -n sme -r 512 -f /dev/main/sme \
-b xenbr0 --nographics -l \
http://distro.ibiblio.org/pub/linux/distributions/smeserver/releases/7/smeos/i386 \
-x 'ksdevice=link ip=dhcp selinux=0 text'


Where /dev/main/sme is the empty lvm you have created to house your sme installation.  You can also change the url to point to a closer mirror or to loop mounted copy of the iso.

This will install sme and create the /etc/xen/sme file correctly for you.  You won't need to connect with vnc and won't have to tweak anything afterwords either.  I'm not sure if other distros contain the virt-install but I do know that el5/cos5 do.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." -- Rich Cook

Offline pietdejong

  • 8
  • +0/-0
Re: HowTO: Sme 7.2 as DomU under DebianEtch Xen3.1
« Reply #2 on: January 18, 2008, 06:52:52 AM »
Hi Slords,
Tried to run your command, but get the error:

#virt-install -n sme -r 512 -f  /var/lib/xen/images/sme.img -b xenbr0 -l http://distro.ibiblio.org/pub/linux/distributions/smeserver/releases/7.3/smeos/i386 -x 'ksdevice=link ip=dhcp selinux=0 text'
Would you like a fully virtualized guest (yes or no)?  This will allow you to run unmodified operating systems. n
 How large would you like the disk (/var/lib/xen/images/sme.img) to be (in gigabytes)? 40
 Would you like to enable graphics support? (yes or no) n


Starting install...
ERROR:  Could not find an installable distribution the install location


Any ideas why virt-install is complaining ?
I have successfully installed Centos 5.1 as paravirtual with a URL to installation source.

Many thanks.
Piet

Offline byte

  • *
  • 2,183
  • +2/-0
Re: HowTO: Sme 7.2 as DomU under DebianEtch Xen3.1
« Reply #3 on: January 18, 2008, 10:49:08 AM »
Any ideas why virt-install is complaining ?

It looks like ibiblio site is some issues, try another mirror.
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline pietdejong

  • 8
  • +0/-0
Re: HowTO: Sme 7.2 as DomU under DebianEtch Xen3.1
« Reply #4 on: January 18, 2008, 11:30:45 AM »
Tried several other mirrors. Unfortunately same result.

Offline SoftDux

  • ****
  • 240
  • +0/-0
    • http://www.SoftDux.com
Re: HowTO: Sme 7.2 as DomU under DebianEtch Xen3.1
« Reply #5 on: February 26, 2008, 09:13:11 AM »
how would I install SME on CentOS 5.0 without LVM?