Virtual openSUSE : Différence entre versions

Un article de Bulles.
Aller à : navigation, rechercher
(Installing)
Ligne 6: Ligne 6:
 
Installing an [http://www.opensuse.org/ openSUSE] virtual machine on top of a [http://www.xensource.com Xen 3.1.0] hypervisor with a [http://www.debian.org Debian Etch] ''Dom0'' is part of these things!
 
Installing an [http://www.opensuse.org/ openSUSE] virtual machine on top of a [http://www.xensource.com Xen 3.1.0] hypervisor with a [http://www.debian.org Debian Etch] ''Dom0'' is part of these things!
  
Here are teh few steps that need to be done to get an [http://www.opensuse.org/ openSUSE] as ''DomU'' up and running.
+
Here are the few steps that need to be done to get an [http://www.opensuse.org/ openSUSE] as ''DomU'' up and running.
  
 
= About the installer =
 
= About the installer =
Ligne 24: Ligne 24:
  
 
= Kernel =
 
= Kernel =
To boot our virtual machine, we need a ''xenified'' installation kernel. This kernel is available on any [http://www.opensuse.org/ openSUSE] mirror.
+
To boot our virtual machine, we need a ''xenified'' installation kernel. This kernel is available on any [http://www.opensuse.org/ openSUSE] [http://en.opensuse.org/Mirrors_Released_Version mirror].
  
 
{{Box Code|shell| 2=<nowiki></nowiki>
 
{{Box Code|shell| 2=<nowiki></nowiki>
Ligne 93: Ligne 93:
 
== Booting ==
 
== Booting ==
  
Before starting [http://en.opensuse.org/YaST YaST], the installer will run [http://en.opensuse.org/Linuxrc Linuxrc] to gather all the parameters needed for the install. To make our life easy, we will pass all these paramters from the command line:
+
Before starting [http://en.opensuse.org/YaST YaST], the installer will run [http://en.opensuse.org/Linuxrc Linuxrc] to gather all the parameters needed for the install. To make our life easier, we will pass all these parameters from the command line:
 
{{Box Code|shell|2=<nowiki></nowiki>
 
{{Box Code|shell|2=<nowiki></nowiki>
 
  LinuxRC="hostip=<DomU ip>/<net> gateway=<gw ip> nameserver=<ns ip> install=${Mirror}"
 
  LinuxRC="hostip=<DomU ip>/<net> gateway=<gw ip> nameserver=<ns ip> install=${Mirror}"
 
}}
 
}}
  
You need now to choose between the ''character mode'', the ''vfb'' and the ''VNC'' install.
+
We need now to choose between the ''character mode'', the ''vfb'' and the ''VNC'' install.
<br />I recommend to go either for the the ''character mode'' or the ''VNC'' approach, as the ''vfb'' method as some issues with the mouse tracking.
+
<br />I recommend to go either for the the ''character mode'' or the ''VNC'' approach, as the ''vfb'' method has some issues with the mouse tracking.
  
In all scenarios, we override the bootloader directive and specify the installation kernel.
+
In all scenarios, we override the ''bootloader'' directive and specify the installation kernel.
 
<br />We also need to ask for a ''destroy'' at reboot time, otherwise the virtual machine would re-enter the installation procedure when done!
 
<br />We also need to ask for a ''destroy'' at reboot time, otherwise the virtual machine would re-enter the installation procedure when done!
  
Ligne 116: Ligne 116:
  
 
===  Xen Virtual Frame Buffer ===
 
===  Xen Virtual Frame Buffer ===
To start the installation, we create the virtual machine:
+
We start the installation with the following incantation:
 
{{Box Code|shell|2=<nowiki></nowiki>
 
{{Box Code|shell|2=<nowiki></nowiki>
 
  xm create /etc/xen/openSUSE.cfg \
 
  xm create /etc/xen/openSUSE.cfg \

Version du 14 novembre 2007 à 08:58

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 the 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, ...).

The installer can be started in three modes:

  • text mode;
  • graphical mode using 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);
  • graphical mode using 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

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.

Installation

Booting

Before starting YaST, the installer will run Linuxrc to gather all the parameters needed for the install. To make our life easier, we will pass all these parameters from the command line:

Code: shell

LinuxRC="hostip=<DomU ip>/<net> gateway=<gw ip> nameserver=<ns ip> install=${Mirror}"

We need now to choose between the character mode, the vfb and the VNC install.
I recommend to go either for the the character mode or the VNC approach, as the vfb method has some issues with the mouse tracking.

In all scenarios, 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!

Text Mode

To start the installation, we create the virtual machine:

Code: shell

xm create -c /etc/xen/openSUSE.cfg \
          vfb='type=vnc,vncunused=1' \
          bootloader= kernel=/boot/opensuse/vmlinuz-xenpae-install \
          ramdisk=/boot/opensuse/initrd-xenpae-install \
          extra="xencons=tty ${LinuxRC}" \
          on_reboot=destroy

Xen Virtual Frame Buffer

We start the installation with the following incantation:

Code: shell

xm create /etc/xen/openSUSE.cfg \
          vfb='type=vnc,vncunused=1' \
          bootloader= kernel=/boot/opensuse/vmlinuz-xenpae-install \
          ramdisk=/boot/opensuse/initrd-xenpae-install \
          extra="${LinuxRC}" \
          on_reboot=destroy

We start xvncviewer to access the install console -- e.g.:

Code: shell

xvncviewer -via <Dom0> :1

Installer's VNC

The openSUSE installer is smart enough to run a VNC server for network installations.
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 \
          extra="vnc=1 vncpassword=<mypass> vnc${LinuxRC}" \
          on_reboot=destroy

The password must be at least 8 characters long!

Note that this time, we connect directly to the virtual machine and no more to the Dom0:

Code: shell

xvncviewer <DomU>:1

Installing

Your are now in the (graphical) installer.
You will be asked for the language, timezone...

When it comes to the Overview, switch to Expert mode and ensure grub is selected as boot loader. This is not the case by default!

Attention: You need to get this right, otherwise you will be in trouble when the system reboots. You need to ensure that we ave
  • /boot/vmlinuz-xenpae for the kernel image
  • /boot/initrd-xenpae for the ramdisk

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

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

Time to look at the openSUSE slide show or grab a coffee!

Reboot

At the end of the installation, the system reboots and you are back at the command prompt of your Dom0 host.

Since we specified the on_reboot=destroy parameter, we need to restart the virtual machine, using this time only the parameters from the configuration file:

Code: shell
xm create -c /etc/xen/openSUSE.cfg 

After the pygrub boot screen the system will start, ask a couple of post-install questions and you are done!

Welcome to openSUSE 10.3 (i586) - Kernel 2.6.22.5-31-xenpae (tty1).

openSUSE login:

Post Install

You can now connect to your system via the console or using ssh.

Graphical session is available through the Xen Virtual Frame Buffer or directly via VNC if you have enabled VNC remote console in YaST.