A convenient way to prepair an image is by using KVM on your workstion. Install from the Net or the netinst.iso Keep in mind:
After the reboot test, before the shutdown and copy-over to the Xen dom0, a few modifications are needed:
To have a console (with xm console on the Dom0), including a login prompt, you need to have a line in /etc/inittab with:
1:2345:respawn:/sbin/getty 38400 hvc0
Adapt the filesystemlines in /etc/fstab from /dev/sda1 to /dev/vda1
Now shutdown, and copy over the image file to the dom0 system. KVM usually leaves its image files in /var/lib/libvirt/images/*.img
Use dd to place this disk-image file on a logicalvolume.
An example minimal config with pygrub:
name = "deb6" memory = 1024 vcpus = 1 bootloader = "/usr/lib/xen-4.0/bin/pygrub" disk = [ "phy:/dev/mapper/vg00-deb6disk0,xvda,w" ] vif = [ "mac=00:16:3c:53:ba:f9,bridge=xenbr0" ] extra = "clocksource=jiffies"
See below.
As preparation, adapt /etc/apt/sources and execute:
apt-get update
Now comes the more tricky part, execute the steps below, and do not reboot in between:
touch /etc/udev/kernel-upgrade apt-get dist-upgrade -fu
Only when the Dom0 is xen-3 (i.e. pygrub is not grub-2 capable)
apt-get install grub-legacy
Adapt /boot/grub/menu.lst and append console=hvc0 to the kernel line, like this:
kernel /vmlinuz-2.6.... root=/..... ro console=hvc0 xencons=tty
When the Dom0 is xen-4 or later (i.e. pygrub is grub-2 capable)
upgrade-from-grub-legacy rm -f /boot/grub/menu.lst*
In /etc/inittab you need at least this line:
1:2345:respawn:/sbin/getty 38400 hvc0
Done. Now you can safe reboot the domU system. You will have a working console.
New clock behaviour in newer kernels. The result is 'clock went backwards' problems. Add the line below to the domU.conf start file:
extra="clocksource=jiffies"
In case your hardware does not match de Solaris-x86 hardware compatibility list, but you do want to run one or more Solaris machines, Xen is a solution. In this case, Linux is used for the dom0, so all drivers of Linux can be used to adress the hardware. The Xen hypervisor layer does the i/o translation
Nexenta is a recently developed distribution of OpenSolaris, which combines the kernel and some great features like ZFS with the usability developed by Debian. A good direction for Solaris in my opinion.
The link below is describes the installation steps of the Solaris/Linux combination: See: http://wiki.tardis.ed.ac.uk/index.php/OpenSolaris_Xen_domU
RHEL6 runs as Xen PV (paravirtual) domU using the pvops framework in the default kernel.
A convenient way to make the raw image for domU usage is with KVM. Install from the CDrom, the usual way. To use this image as a domU, edit the /etc/grub.conf in the image (by using KVM) and add to the kernel line:
console=hvc0
After this, this machine will not have a console with KVM anymore when rebooted in KVM. So shut it down, and copy it over to the xen dom0 machine.
A minimal domU.conf file example is:
name = "rh6beta" memory = 1024 vcpus = 2 bootloader = "/usr/lib/xen-4.0/bin/pygrub" disk = [ "phy:/dev/mapper/vg00-rh6disk0,xvda,w" ] vif = [ "mac=00:16:34:f2:3b:7f,bridge=xenbr3"] extra = "clocksource=jiffies"
When the mac-adres of the domU has changed, update the configfiles:
A convenent way to make the raw image is with KVM. Install from the Net or the CDrom, the usual way, but keep in mind:
After the reboot test, before the shutdown and copy-over to the Xen dom0, a few modifications are needed:
Install a kernel with the pv_ops externtions:
apt-get install linux-image-virtual
# most important: cp /etc/init/tty0.conf /etc/init/hvc0.conf sed -i 's|tty0|hvc0|g' /etc/init/hvc0.conf # to be complete: mv /etc/init/tty1.conf /etc/init/tty1.conf.disabled mv /etc/init/tty2.conf /etc/init/tty2.conf.disabled mv /etc/init/tty3.conf /etc/init/tty3.conf.disabled mv /etc/init/tty4.conf /etc/init/tty4.conf.disabled mv /etc/init/tty5.conf /etc/init/tty5.conf.disabled mv /etc/init/tty6.conf /etc/init/tty6.conf.disabled
mv /etc/init/ureadahead.conf /etc/init/ureadahead.conf.disable mv ureadahead-other.conf ureadahead-other.conf.disable
Now shutdown, and copy over the image file to the dom0 system. KVM usually leaves its image files in /var/lib/libvirt/images/*.img
Use dd to place this disk-image file on a logicalvolume.
name = "ubu1004serv" memory = 1024 vcpus = 1 #kernel = "/var/xen/kernels/ubuntu/vmlinuz-2.6.32-24-server" #ramdisk = "/var/xen/kernels/ubuntu/initrd.img-2.6.32-24-server" #root = "/dev/mapper/vg01-root ro" # bootloader = "/usr/lib/xen-3.4/bin/pygrub" #extra = "console=hvc0 xencons=tty" # vfb = [ ] on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" # disk = [ "phy:/dev/mapper/vg00-ubu1004disk0,xvda,w" ] vif = [ "mac=00:16:3c:53:ba:f9,bridge=xenbr0"]
See also:
In case your hardware does not match de Solaris-x86 hardware compatibility list, but you do want to run one or more Solaris machines, Xen is a solution. In this case, Linux is used for the dom0, so all drivers of Linux can be used to adress the hardware. The Xen hypervisor layer does the i/o translation
Nexenta is a recently developed distribution of OpenSolaris, which combines the kernel and some great features like ZFS with the usability developed by Debian. A good direction for Solaris in my opinion.
The link below is describes the installation steps of the Solaris/Linux combination: See: http://wiki.tardis.ed.ac.uk/index.php/OpenSolaris_Xen_domU
Install the debootstrap package on the dom0 if you don't already have that package. Now create a minimal system installation in a subdirectory to bootstrap:
apt-get install debootstrap mkdir -p /opt/xen/stock/deb-etch debootstrap --arch amd64 etch /opt/xen/stock/deb-etch ftp://ftp.debian.org/debian
(this will use the /etc/apt/sources.list file on the dom0 in order to be able to find the Debian repository)
chroot /opt/xen/stock/deb-etch apt-get install xfsprogs xfsdump udev vim ethtool
If (and ONLY if!) your dom0 has a x86-32 kernel/hypervisor, install TLS friendly libraries instead of disabling them in the domU (remember, in the old Sarge days we had to rename the dir /lib/tls to /lib/tls.disabled):
apt-get install libc6-xen
Finally leave the chroot.
exit
TODO
Add more steps here to create the stock rootfs file, so it can be used during "Prepair a domU"
For administration maintenance copy the xen-kernel and its ramdisk from /boot in the dom0 to /opt/xen/kernels/<arch>
mkdir -p /opt/xen/kernels/amd64 cp /boot/vmlinuz-2.6.18-5-xen-amd64 /opt/xen/kernels/amd64 cp /boot/initrd.img-2.6.18-5-xen-amd64 /opt/xen/kernels/amd64
As you want to use this kernel for your domU's, they'll need the kernel-modules, so copy them from /lib/modules in the dom0 to /lib/modules/ in your domU rootfs
cp -a /lib/modules/2.6.18-5-xen-amd64 /opt/xen/stock/deb-etch/lib/modules
lvcreate -n mydomuroot -L 1G vg00
lvcreate -n mydomuswap -L 200M vg00 mkswap /dev/vg00/mydomuswap
mkfs.xfs /dev/vg00/mydomuroot mount /dev/vg00/mydomuroot /mnt cd /opt/xen/stock/deb-etch tar cf - . | (cd /mnt && tar xf -)
adjust these files in the domU's root filesystem.
# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 none /dev/pts devpts defaults 0 0 /dev/hda1 / xfs defaults 0 1 /dev/hda2 none swap sw 0 0
echo "<your emailaddress> > /root/.forward install postfix and choose "satelite system"
apt-get install openssh-server
apt-get install udev
First create a subdirectory for the configuration files of your new guest.
mkdir -p /opt/xen/mydomu
The configuration file itself /opt/xen/mydomu/domu.conf (also known as the spec file) has this content. The guest in our example has 128Mb memory, one nic with a static MAC-address (we prefer to administer them ourselves), one root partition and one swap partition.
kernel = "/opt/xen/kernels/amd64/vmlinuz-2.6.18-5-xen-amd64" ramdisk = "/opt/xen/kernels/amd64/initrd.img-2.6.18-5-xen-amd64" memory = 128 name = "mydomu" vif = [ 'mac=00:16:3E:17:75:17,bridge=xenbr0' ] disk = [ 'phy:mapper/vg00-mydomuroot,hda1,w' , \ 'phy:mapper/vg00-mydomuswap,hda2,w' ] root = "/dev/hda1 ro" extra = "2" #extra = "console=hvc0 xencons=tty" # 2.6.26-x-xen
Now create a file to boot the new guest, /opt/xen/mydomu/domu.sh
XEN_NAME=mydomu XEN_HOME=/opt/xen/${XEN_NAME} export XEN_NAME XEN_HOME echo "Starting XEN ${XEN_NAME} ..." /usr/sbin/xm create ${XEN_NAME} -f ${XEN_HOME}/domu.conf
Grant the proper permissions.
chmod 755 /opt/xen/mydomu/domu.sh
Now you finally should be able to succesfully start the new guest.
cd /opt/xen/mydomu ./domu.sh
Create a directory /etc/xen/auto and put the domU configuration file in this directory (or create a symbolic link).
In case you have a lot of domU's, a problem might arise that networking fails when using automatic startup.
Configure locales to get rid of the message Setting locale failed
apt-get install locales dpkg-reconfigure locales
In case you get this message: “Couldn't get a file descriptor referring to the console”, you might remove the console packages within the domU's as the dom0 already provides the keymap.
apt-get remove --purge console-common console-data console-tools libconsole
To get rid of the en_US.UTF-8 warnings from apt/perl, add to /root/.profile
unset LANG
To disable the indentation (which is by now the default in debian), add the two lines below to /etc/vim/vimrc:
set noautoindent set paste