DomU Install with Virt-Install: Difference between revisions

From Xen
Jump to navigationJump to search
Line 2: Line 2:
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 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 was done using a Fedora 13 dom0. However, it should work fine with later Fedora releases.
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.

Check the virt-manager examples above for all the basic LVM usage tips and how to install required packages. virt-install gets installed automatically when you install virt-manager and related packages as shown in the examples above.


===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.
===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.
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:
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 16:
</nowiki></pre>
</nowiki></pre>


Next make sure you have the ssh X11 forwarding enabled, since the command below will open graphical VNC window for the guest console to show the graphical Fedora installer.
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 Fedora 13 installation using virt-install. Specify the newly created LVM volume as the guest virtual disk ("-f" parameter):


Start the domU installation with:


<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"
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"
</nowiki></pre>
</nowiki></pre>


For more information on what each parameter does, refer to the virt-install man page. A brief summary:
Example output from virt-install:
* -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:


<pre><nowiki>
<pre><nowiki>
Line 37: Line 42:
</nowiki></pre>
</nowiki></pre>


And then graphical 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.


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".
Select IPV4 networking with DHCP in the Fedora installer. 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 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.

After the installer files have been downloaded the graphical phase of the Fedora 13 installer starts:


http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-02.png
http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-02.png

Revision as of 06:20, 8 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

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.