Unbreakable Xen : Différence entre versions

Un article de Bulles.
Aller à : navigation, rechercher
M
Ligne 30: Ligne 30:
 
= Disk allocation =
 
= Disk allocation =
 
We use a logical volume to allocate disk space for the virtual machine:
 
We use a logical volume to allocate disk space for the virtual machine:
{{Box Code|shell| lvcreate  -L 50000 -n unbreakable vgDomU }}
+
{{Box Code|shell| lvcreate  -L 20480 -n unbreakable 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).
 
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).
  
Ligne 52: Ligne 52:
 
   
 
   
 
  # Initial memory allocation (in megabytes) for the new domain.
 
  # Initial memory allocation (in megabytes) for the new domain.
  memory = 256
+
  memory = 2048
 
   
 
   
 
  # A name for your domain. All domains must have different names.
 
  # A name for your domain. All domains must have different names.
Ligne 111: Ligne 111:
 
   
 
   
 
  # Initial memory allocation (in megabytes) for the new domain.
 
  # Initial memory allocation (in megabytes) for the new domain.
  memory = 256
+
  memory = 2048
 
   
 
   
 
  # A name for your domain. All domains must have different names.
 
  # A name for your domain. All domains must have different names.

Version du 4 juillet 2007 à 14:19

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

Foreword

I wanted to install an Unbreakable Linux virtual machine on top of my Xen 3.1.0 hypervisor with a Debian Etch Dom0.

I am unfamiliar with Unbreakable Linux, and I could not find a clear guidance on how to proceed.

Most of the articles available on the web are describing homogeneous environments where the Dom0 and the DomU machines are running the same Linux flavour.

The rpm-based distributions are using the Virtual Machine Manager but it is not available under Debian; on the other hand, the Xen-tools are rpm-aware, but they are based on rpmstrap: there is support for Unbreakable Linux or RedHat...

It remains the manual option, which is really easy, but not very well documented; so hopefully this article will help some other lost souls...

I describe an Unbreakable Linux - Enterprise Linux 5 installation, but obviously it applies to Red Hat Enterprise Linux 5 as well.

Package repository

There is no way to install directly from the CD-ROM or ISO in para-virtualized mode (PVM), so you have to copy the files somewhere.
The installer can get its packages in several way, but the easiest in my view is via the web. So we copy the content the 5 distribution CDs on a web server. It can be done on the Dom0 system, but it does not really matter.
So we assume that the full distribution is available via http://<server>/unbreakable/

Kernel

To boot our virtual machine, we need a xenified installation kernel. This kernel is available on the Enterprise-R5-GA-Server-i386-disc1.iso CD or, more easily, on our new repository!

Code: shell
mkdir /boot/unbreakable-xen
cd /boot/unbreakable-xen
wget http://<server>/unbreakable/images/xen/vmlinuz
wget http://<server>/unbreakable/images/xen/initrd.img

Disk allocation

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

Code: shell
lvcreate  -L 20480 -n unbreakable 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 a minimal configuration file:

Fichier: /etc/xen/unbreakable-install.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.
kernel = "/boot/unbreakable/vmlinuz"

# Optional ramdisk.
ramdisk = "/boot/unbreakable/initrd.img"

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

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

#----------------------------------------------------------------------------
# Define network interfaces.
vif = [ 'ip=xxx.xxx.xxx.xxx,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/unbreakable,xvda,w' ]

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

Installation

To start the installation, we just have to create the virtual machine:

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

The system will boot, 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.

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 get:

Congratulations, your Enterprise Linux installation is complete.

Reboot

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

We need to shutdown the virtual machine now and update the configuration file, unless you want to restart the installation again!

Code: shell
xm shutdown unbreakable 

In the configuration file, we just need to replace the kernel and ramdisk directives by the bootloader one.
The interresting aspect of pygrub is that the linux kernel is now taken from the DomU virtual machine and no more from the Dom0 host.

Fichier: /etc/xen/unbreakable.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 = 2048

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

#----------------------------------------------------------------------------
# Define network interfaces.
vif = [ 'ip=xxx.xxx.xxx.xxx,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/unbreakable,xvda,w' ]

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

Restart the virtual machine:

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

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

Enterprise Linux Enterprise Linux Server release 5 (Carthage)
Kernel 2.6.18-8.el5xen on an i686

unbreakable login:

Post Install

You can now connect to your new system using ssh.

Should you need a GUI, you can always start a VNC server; the necessary steps are described in this article.