Thomas Vogt’s IT Blog

knowledge is power …

Xen Guest (DomU) Installation

OS: RedHat Enterprise Linux 5 (RHEL5), should also work on CentOS and Fedora.

There are a few methodes to install a Xen Guest (DomU). In my experience the easiest and smoothest way for such an installation is to use the virt-install script, which is installed by default on RedHat Linux systems.

Xen Packages

First of all, we have to install the Xen Virtualization packages (kernel-xen-devel is optional, but for example needed by HP ProLiant Supprt Pack (PSP)).

# yum install rhn-virtualization-common rhn-virtualization-host kernel-xen-devel virt-manager

On CentOS and Fedora:

# yum groupinstall Virtualization

After that a reboot for loading the Xen kernel is needed.

Guest Installation with virt-install

In the following example the Xen Guest installation is made with a kickstart config file. The kickstart file and the OS binaries are on a provisioning server (cobbler) and reachable over the http protocol.

# virt-install -x ks=http://lungo.pool/cblr/kickstarts/rhel51-x86_64_smbxen/ks.cfg

Would you like a fully virtualized guest (yes or no)?  This will allow you to run unmodified operating systems. no

 What is the name of your virtual machine? smbxen

 How much RAM should be allocated (in megabytes)? 1024

 What would you like to use as the disk (path)? /dev/vg_xen/lv_smbxen

 Would you like to enable graphics support? (yes or no) yes

 What is the install location? http://lungo.pool/cblr/links/rhel51-x86_64/   

Starting install...

Retrieving Server...                                            651 kB 00:00

Retrieving vmlinuz...     100% |=========================| 1.8 MB    00:00

Retrieving initrd.img...  100% |=========================| 5.2 MB    00:00

Creating domain...                                                 0 B 00:00

VNC Viewer Free Edition 4.1.2 for X - built Jan 15 2007 10:33:11

At this point a regular RedHat OS installation (graphical installer) starts.

To automatically run the guest after a system (Dom0) reboot, we have to create the following link:

# ln -s /etc/xen/[guest_name] /etc/xen/auto/


We can manage the Xen Guest with xm commands, virsh commands or virt-manager.

Virt-Manager

# virt-manager

virt-manager


xm commands

List Domains (Xen Guests)

# xm list

Start a Guest

# xm create [guest-config]

Connect to a guest console ( Back: ESC-] (US-keyboard), Ctrl-5 (German keyboard))

# xm console [guest_name]

Shutdown a guest

# xm shutdown [guest_name]

Destroy (Power off) a guest

# xm destroy [guest_name]

Monitor guests

# xm top


virsh commands

# virsh
virsh # help 

Commands:

    autostart       autostart a domain
    capabilities    capabilities
    connect         (re)connect to hypervisor
    console         connect to the guest console
    create          create a domain from an XML file
    start           start a (previously defined) inactive domain
    destroy         destroy a domain
    define          define (but don't start) a domain from an XML file
    domid           convert a domain name or UUID to domain id
    domuuid         convert a domain name or id to domain UUID
    dominfo         domain information
    domname         convert a domain id or UUID to domain name
    domstate        domain state
    dumpxml         domain information in XML
    help            print help
    list            list domains
    net-autostart   autostart a network
    net-create      create a network from an XML file
    net-define      define (but don't start) a network from an XML file
    net-destroy     destroy a network
    net-dumpxml     network information in XML
    net-list        list networks
    net-name        convert a network UUID to network name
    net-start       start a (previously defined) inactive network
    net-undefine    undefine an inactive network
    net-uuid        convert a network name to network UUID
    nodeinfo        node information
    quit            quit this interactive terminal
    reboot          reboot a domain
    restore         restore a domain from a saved state in a file
    resume          resume a domain
    save            save a domain state to a file
    schedinfo       show/set scheduler parameters
    dump            dump the core of a domain to a file for analysis
    shutdown        gracefully shutdown a domain
    setmem          change memory allocation
    setmaxmem       change maximum memory limit
    setvcpus        change number of virtual CPUs
    suspend         suspend a domain
    undefine        undefine an inactive domain
    vcpuinfo        domain vcpu information
    vcpupin         control domain vcpu affinity
    version         show version
    vncdisplay      vnc display
    attach-device   attach device from an XML file
    detach-device   detach device from an XML file
    attach-interface attach network interface
    detach-interface detach network interface
    attach-disk     attach disk device
    detach-disk     detach disk device

Exp.: Start a guest with virsh

# virsh start [guest_name]

March 31, 2008 Posted by | Linux, RedHat, Virtualization, Xen | 11 Comments