Difference between revisions of "DomU Install with Virt-Install"

From Xen
(Added to various missing categories)
(Using virt-install)
Line 6: Line 6:
 
===Getting virt-install===
 
===Getting virt-install===
 
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.
 
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.
===Using virt-install===
+
===Using virt-install to do a graphical installation===
  +
First we'll create a new logical volume (on the volume group vg_f13) to be used as the virtual disk for the F13 Xen guest:
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:
 
   
 
<pre><nowiki>
 
<pre><nowiki>
Line 16: Line 14:
 
</nowiki></pre>
 
</nowiki></pre>
   
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
+
If you're connecting to the dom0 over SSH, now is the time to make sure you have [http://www.cs.caltech.edu/courses/cs11/misc/xwindows.html 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 the VNC viewer won't automatically start, and you won't be able to monitor the progress of the installation.
   
 
Start the domU installation with:
 
Start the domU installation with:
   
 
<pre><nowiki>
 
<pre><nowiki>
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"
+
virt-install -n f13 -r 768 --vcpus=1 -f /dev/vg_f13/f13 --graphics vnc -p -l "http://ftp.funet.fi/pub/mirrors/fedora.redhat.com/pub/fedora/linux/releases/13/Fedora/i386/os"
 
</nowiki></pre>
 
</nowiki></pre>
   
Line 31: Line 29:
 
* -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.
 
* -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:
+
After you run virt-install, you'll see something like this:
   
 
<pre><nowiki>
 
<pre><nowiki>
[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"
+
[root@f13 ~]# virt-install -n f13 -r 768 --vcpus=1 -f /dev/vg_f13/f13 --graphics vnc -p -l "http://ftp.funet.fi/pub/mirrors/fedora.redhat.com/pub/fedora/linux/releases/13/Fedora/i386/os"
 
Starting install...
 
Starting install...
 
Retrieving file .treeinfo... | 2.8 kB 00:00 ...
 
Retrieving file .treeinfo... | 2.8 kB 00:00 ...
Line 43: Line 41:
   
 
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.
 
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.
  +
  +
From there, you can install Fedora as usual.
   
 
http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-01.png
 
http://pasik.reaktio.net/fedora/f13xen4tutorial/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.
 
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.
   
 
http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-02.png
 
http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-02.png
   
  +
Install Fedora 13 as usual.
 
   
 
[[Category:Beginners]]
 
[[Category:Beginners]]

Revision as of 01:36, 9 November 2011

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 to do a graphical installation

First we'll create a new logical volume (on the volume group vg_f13) 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 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 the VNC viewer won't automatically start, and you won't be able to monitor the progress of the installation.

Start the domU installation with:

virt-install -n f13 -r 768 --vcpus=1 -f /dev/vg_f13/f13 --graphics 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.

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 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.

From there, you can install Fedora as usual.

f13-01.png

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