Virtual openSUSE

Un article de Bulles.
Révision datée du 13 novembre 2007 à 20:08 par Philippe (discussion | contribs) (Kernel)
Aller à : navigation, rechercher

This article summarizes the major steps to install openSUSE 10.3 as DomU using a Debian Etch / Xen 3.1.0 Dom0 as described in this Xen article.

Foreword

Everything is easy once you know how to do it!

Installing an openSUSE virtual machine on top of a Xen 3.1.0 hypervisor with a Debian Etch Dom0 is part of these things!

Here are teh few steps that need to be done to get an openSUSE as DomU up and running.

About the installer

The openSUSE installer comes in different flavours. We will use the Network installer.

There are roughly 2 major steps in the install process:

  1. The kernel boots with its initial ramdisk. It will asks for the basic information: language, keyboard, source for packages and network configuration.
  2. The graphical installer is then started to perform the actual installation (partitioning, packages selection, ...).

There may be a way to start the installer in console mode, but the easiest is

  • either use the Xen virtual frame buffer (vfb). Note that this feature is not compiled by default in Xen (see re-compile Xen article should you need to recompile);
  • or use the VNC feature of the installer (recommended)

Package repository

There is no need to host local mirror of the packages, as the openSUSE network installer is able to fetch the packages direcly from the Mirrors Released Version. Just select a repository near you!

Kernel

To boot our virtual machine, we need a xenified installation kernel. This kernel is available on any openSUSE mirror.

Code: shell

mkdir /boot/opensuse
Mirror=http://ftp.skynet.be/pub/ftp.opensuse.org/opensuse/distribution/10.3/repo/oss
wget ${Mirror}/boot/i386/vmlinuz-xenpae -O /boot/opensuse/vmlinuz-xenpae-install
wget ${Mirror}/boot/i386/initrd-xenpae  -O /boot/opensuse/initrd-xenpae-install
umount /mnt

Note that there is also a non-pae kernel available in the repository.

Disk allocation

We use a logical volume to allocate disk space for the virtual machine:

Code: shell
lvcreate  -L 10240 -n openSUSE vgDomU 

It will be used as Disk Image (xvd) by the virtual machine. This gives more flexibility to the guest than individual partitions (hd), and makes the boot process easier (see below).

Xen DomU Configuration file

This is the minimal configuration file that we will use for this installation:

Fichier: /etc/xen/openSUSE.cfg

#  -*- mode: python; -*-
#============================================================================
# Python configuration setup for 'xm create'.
# This script sets the parameters used when a domain is created using 'xm create'.
# You use a separate script for each domain you want to create, or
# you can set the parameters for the domain on the xm command line.
#============================================================================

#----------------------------------------------------------------------------
# Kernel image file.
bootloader="/usr/bin/pygrub"

# Initial memory allocation (in megabytes) for the new domain.
memory = 512

# A name for your domain. All domains must have different names.
name = "openSUSE"

#----------------------------------------------------------------------------
# Define network interfaces.
vif = [ 'ip=xxx.xxx.xxx.xxx,mac=yy:yy:yy:yy:yy:yy,bridge=xenbr0' ]

#----------------------------------------------------------------------------
# Define the disk devices you want the domain to have access to, and
# what you want them accessible as.
# Each disk entry is of the form phy:UNAME,DEV,MODE
# where UNAME is the device, DEV is the device name the domain will see,
# and MODE is r for read-only, w for read-write.
disk = [ 'phy:/dev/vgDomU/openSUSE,xvda,w' ]

#----------------------------------------------------------------------------
# Define frame buffer device.
vfb = ["type=vnc,vncunused=1"]
keymap = 'fr-be'

#----------------------------------------------------------------------------
# Configure the behaviour when a domain exits.  There are three 'reasons'
# for a domain to stop: poweroff, reboot, and crash.
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

#============================================================================

The interresting aspect of using pygrub as bootloader instead of specifying a kernel and a ramdisk is that the linux kernel will be taken from the DomU virtual machine and not from the Dom0 host. Obviously we will have to override that during the installation.

We also have to enable the virtual frame buffer -- do not forget to set the right keymap!

Installation

To start the installation, we create the virtual machine:

Code: shell

xm create /etc/xen/openSUSE.cfg \
          bootloader= kernel=/boot/opensuse/vmlinuz-xenpae-install \
          ramdisk=/boot/opensuse/initrd-xenpae-install \
          on_reboot=destroy

We override the bootloader directive and specify the installation kernel.
We also need to ask for a destroy at reboot time, otherwise the virtual machine would re-enter the installation procedure when done!

We start xvncviewer -- e.g.:

Code: shell

xvncviewer -via <Dom0> :1

The system will boot and say it cannot find the repository.
You will be asked for language and keyboard, and then start the installation, and when asked for the Installation Method, choose HTTP.
You will have to enter the network configuration (IP, ...) as well as the location of the package repository (e.g. server: ftp.skynet.be, repository: /pub/ftp.opensuse.org/opensuse/distribution/10.3/repo/oss/).

The machine will find the packages and proceed with the installation just like on a bare metal system.

As we will use pygrub later on, we need to configure grub (just accept all defaults).

Note that the installer is smart enough to see it is running under Xen, and will select the appropriate kernel.

Be patient and after a while (depending the number of packages you choosed!), you will reboot.

Now for whatever reason, no bootloader will be installed, so

Reboot

Post Install