DomU Install with Virt-Install

From Xen
Jump to navigationJump to search

Installing new Xen guests using the command line virt-install

Virt-install is not part of Xen, but it's developed by Redhat and included in Fedora, and it can be used to install new Xen guests, among others.

Note: This example is installing a Fedora 13 domU onto a Fedora 13 dom0. However, the same technique should work for installing Fedora/RHEL/CentOS domUs on all dom0s with virt-install.

Getting virt-install

virt-install gets installed automatically when you install virt-manager and related packages. Check the virt-manager examples for steps to install required packages, as well as details on basic LVM usage tips.

Using virt-install

In this example we're going to install Fedora 13 x86 (32bit) Xen PV guest using the command line virt-install tool.

First we'll create a new LVM volume to be used as the virtual disk for the F13 Xen guest:

[root@f13 ~]# lvcreate -nf13 -L40G /dev/vg_f13
  Logical volume "f13" created

If you're connecting to the dom0 over SSH, now is the time to make sure you have SSH X11 forwarding enabled, since the command below will open graphical VNC window for the guest console to show the graphical Fedora installer. Without X11 forwarding enabled

Start the domU installation with:

virt-install -n f13 -r 768 --vcpus=1 -f /dev/vg_f13/f13 --vnc -p -l "http://ftp.funet.fi/pub/mirrors/fedora.redhat.com/pub/fedora/linux/releases/13/Fedora/i386/os"

For more information on what each parameter does, refer to the virt-install man page. A brief summary:

  • -n <name> will set the name of the domU that appears in the dom0 to name. (It doesn't set the hostname inside the domU.)
  • -r <number> refers to the amount of RAM (in MB) to allocate to the new domU
  • -f <path> refers to the location of the image file that virt-install will use. Can be a disk image, a logical volume or a physical disk
  • -p tells virt-install to use para-virtualization
  • -l <path> is the location of the install files. It should be a network accessible path, not a folder on the local disk - the installation process in the domU will use this location to download the rpm files.

Example output from virt-install:

[root@f13 ~]# virt-install -n f13 -r 768 --vcpus=1 -f /dev/vg_f13/f13 --vnc -p -l "http://ftp.funet.fi/pub/mirrors/fedora.redhat.com/pub/fedora/linux/releases/13/Fedora/i386/os"
Starting install...
Retrieving file .treeinfo...                                                                                 | 2.8 kB     00:00 ...
Retrieving file vmlinuz-PAE...                                                                               | 6.7 MB     00:02 ...
Retrieving file initrd-PAE.img...                                                                            |  74 MB     00:01 ...
Creating domain...                                                                                           |    0 B     00:01

After the installer files have been downloaded the graphical phase of the Fedora 13 installer starts, and a window opens where you can see Fedora 13 installer booting up.

f13-01.png

Continue to install Fedora Select the appropriate networking option in the Fedora installer - normally this is "IPv4 networking with DHCP". Note about disk partitioning for the guest VM: It's good to make the "/boot" partition "ext3" to avoid problems with pygrub loading the kernel from the guest. Xen 4.0.1 onwards properly supports ext4 /boot with pygrub, but you never know if you need to move the image to older systems lacking ext4 support.

f13-02.png

Install Fedora 13 as usual.