DomU Install with Virt-Install: Difference between revisions

From Xen
Jump to navigationJump to search
(Clean up the page, add stuff about installing virt-install, and doing text-mode installation with virt-install)
Line 1: Line 1:
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 domUs (along with KVM based guests).
===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.


virt-install has two modes of installation:
virt-install has two modes of installation:
* graphical, by using VNC, where you get the normal install experience
* graphical, by using VNC, where you get the normal install experience. This is usually used if you're installing on the same system that you're using, but for whatever reason can't use virt-manager.
* non-graphical, by using the emulated serial port, where you get the text-mode installation experience
* text-based, by using the emulated serial port, where you get the console-mode installation experience. This is normally done for remote systems that you connect to via SSH.


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 dom0s with virt-install.
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 dom0s with virt-install.


===Preparing to install/create a new domU===
=Getting virt-install=
This portion is fairly simple - just run <pre>yum install libvirt python-virtinst</pre> and let Yum sort out the dependencies.
virt-install gets installed automatically when you install virt-manager and related packages. Check the [[DomUInstallWithVirtManager|virt-manager examples for steps to install required packages]], as well as details on basic LVM usage tips.


=Preparing to install/create a new domU=
First we'll create a new logical volume to be used as the virtual disk for the domU:
First we'll create a new logical volume to be used as the virtual disk for the domU:


Line 20: Line 20:
This example created a 40GB logical volume named "f13" on the volume group "vg_f13". As such, the install location that we're using is /dev/vg_f13/f13.
This example created a 40GB logical volume named "f13" on the volume group "vg_f13". As such, the install location that we're using is /dev/vg_f13/f13.


===Using virt-install to do a graphical installation===
=Using virt-install to do a graphical installation=
There are 2 possible ways of doing a graphical install:
If you've installed Xen on the computer that you're using, you can safely ignore the discussion on doing a remote graphical install, and just use the virt-install command in the X11 forwarding section.
* Using virt-viewer on the dom0 to display the graphical console - Use this is you're working at the dom0 itself.

* Using a VNC viewer to connect to the graphical console on the dom0 - Use this if you're not working at the dom0, but are connecting to it remotely
Otherwise, there are 2 possible ways of doing a graphical install remotely:
* Using virt-viewer on the dom0 to display the graphical console, and X11 forwarding to display the graphical window on your computer
* Using a local VNC viewer to connect to the graphical console on the dom0

Both methods end up with the same outcome - a graphical console is displayed on your desktop, and each has advantages and disadvantages.

X11 forwarding is more complicated to setup and requires that certain packages be installed, but virt-install will automatically launch the graphical console.

Using a local VNC viewer just requires that you have a VNC viewer on your computer, but requires work to connect to the domU for the installation.

==== Using X11 forwarding for a graphical virt-install ====

If you're using Windows, you can follow [http://www.cs.caltech.edu/courses/cs11/misc/xwindows.html this guide to get X11 forwarding setup]. On Linux and Mac, X11 forwarding should automatically work when you connect to the dom0 with <pre>ssh -X dom0hostname</pre>


== Doing a local graphical virt-install ==
Start the domU installation with:
Start the domU installation with:


Line 66: Line 55:
From there, you can install Fedora as usual.
From there, you can install Fedora as usual.


Note: If you X11 forwarding set up, you can do this on your remote system. If you're using Windows, you can follow [http://www.cs.caltech.edu/courses/cs11/misc/xwindows.html this guide to get X11 forwarding setup]. On Linux and Mac, X11 forwarding should automatically work when you connect to the dom0 with <pre>ssh -X dom0hostname</pre>
==== Using a VNC viewer for a graphical virt-install ====

== Using a remote graphical virt-install ==
This step only involves getting a VNC client on your system, followed by changing the virt-install command.
This step only involves getting a VNC client on your system, followed by changing the virt-install command.


Specifically, you have to tell virt-install to setup the VNC server so you can connect to it. In particular, you'll need to specify the VNC options in the --graphics parameter, so it instead of just <pre>--graphics</pre> it looks like <pre>--graphics vnc,listen=0.0.0.0,port=5901 --noautoconsole</pre>
Specifically, you have to tell virt-install to setup the VNC server so you can connect to it. In particular, you'll need to specify the VNC options in the --graphics parameter, so it instead of just <pre>--graphics</pre> it looks like <pre>--graphics vnc,listen=0.0.0.0,port=5901 --noautoconsole</pre>


When you run virt-install, the initial output will look like the output mentioned above. However, after "creating domain", you'll be returned to the root console. Once that happens, you'll need to start the VNC client on your computer, and connect to hostname-of-dom0:1 to see the graphical console.
When you run virt-install, the initial output will look like the output mentioned above. However, after "creating domain", you'll be returned to the command prompt. Once that happens, you'll need to start the VNC client on your computer, and connect to hostname-of-dom0:1 to see the graphical console.


Note: If you don't specify the port number, the first open port above 5900 will be used. virt-install will tell you what address to connect to when you quit though.
===Using virt-install to do a graphical installation===

TODO: Fill up stuff here. It's mostly to same, but instead of --graphics it's --graphics none, and virt-install takes over the same console that you just ran it from.
=Using virt-install to do a test-based installation=
The virt-install command is mostly the same as the first one. The only difference is that instead of '''--graphics''' it's '''--graphics none''', and virt-install takes over the same console that you just ran it from.

Once the installer files are downloaded, you'll be shown the text mode install screen:


Also, screenshot of text mode installation:
http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-01.png
http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-01.png

===A few points about disk partitioning in the domU===
For there, follow the install instructions for your respective domU distributions.

=A few points about disk partitioning in the domU=


* The "/boot" partition '''must''' be formatted as either "ext3" or "ext4" to avoid problems with pygrub loading the kernel from the disk. btrfs is '''not''' supported by pygrub as of Nov 9th, 2011.
* The "/boot" partition '''must''' be formatted as either "ext3" or "ext4" to avoid problems with pygrub loading the kernel from the disk. btrfs is '''not''' supported by pygrub as of Nov 9th, 2011.

Revision as of 11:27, 29 November 2011

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 domUs (along with KVM based guests).

virt-install has two modes of installation:

  • graphical, by using VNC, where you get the normal install experience. This is usually used if you're installing on the same system that you're using, but for whatever reason can't use virt-manager.
  • text-based, by using the emulated serial port, where you get the console-mode installation experience. This is normally done for remote systems that you connect to via SSH.

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 dom0s with virt-install.

Getting virt-install

This portion is fairly simple - just run

yum install libvirt python-virtinst

and let Yum sort out the dependencies.

Preparing to install/create a new domU

First we'll create a new logical volume to be used as the virtual disk for the domU:

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

This example created a 40GB logical volume named "f13" on the volume group "vg_f13". As such, the install location that we're using is /dev/vg_f13/f13.

Using virt-install to do a graphical installation

There are 2 possible ways of doing a graphical install:

  • Using virt-viewer on the dom0 to display the graphical console - Use this is you're working at the dom0 itself.
  • Using a VNC viewer to connect to the graphical console on the dom0 - Use this if you're not working at the dom0, but are connecting to it remotely

Doing a local graphical virt-install

Start the domU installation with:

virt-install -n f13 -r 768 --vcpus=1 -f /dev/vg_f13/f13 --graphics -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 (e.g. var/xen/images/domU.img), a logical volume (e.g. /dev/volume_group/logical_volume) or a physical disk (e.g. /dev/sdb).
  • -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.

After you run virt-install, you'll see something like this:

[root@f13 ~]# virt-install -n f13 -r 768 --vcpus=1 -f /dev/vg_f13/f13 --graphics -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-02.png

From there, you can install Fedora as usual.

Note: If you X11 forwarding set up, you can do this on your remote system. If you're using Windows, you can follow this guide to get X11 forwarding setup. On Linux and Mac, X11 forwarding should automatically work when you connect to the dom0 with

ssh -X dom0hostname

Using a remote graphical virt-install

This step only involves getting a VNC client on your system, followed by changing the virt-install command.

Specifically, you have to tell virt-install to setup the VNC server so you can connect to it. In particular, you'll need to specify the VNC options in the --graphics parameter, so it instead of just

--graphics

it looks like

--graphics vnc,listen=0.0.0.0,port=5901 --noautoconsole

When you run virt-install, the initial output will look like the output mentioned above. However, after "creating domain", you'll be returned to the command prompt. Once that happens, you'll need to start the VNC client on your computer, and connect to hostname-of-dom0:1 to see the graphical console.

Note: If you don't specify the port number, the first open port above 5900 will be used. virt-install will tell you what address to connect to when you quit though.

Using virt-install to do a test-based installation

The virt-install command is mostly the same as the first one. The only difference is that instead of --graphics it's --graphics none, and virt-install takes over the same console that you just ran it from.

Once the installer files are downloaded, you'll be shown the text mode install screen:

f13-01.png

For there, follow the install instructions for your respective domU distributions.

A few points about disk partitioning in the domU

  • The "/boot" partition must be formatted as either "ext3" or "ext4" to avoid problems with pygrub loading the kernel from the disk. btrfs is not supported by pygrub as of Nov 9th, 2011.
  • Some guides recommend that you format /boot as ext3. This was because pygrub in Xen 3 didn't support /boot formatted as ext4. The version of pygrub included with Xen 4.0.1 onwards properly supports ext4, so you can fairly safely go ahead and format /boot in the domU as ext4.