DomU Install with Virt-Install: Difference between revisions
No edit summary |
Rcpavlicek (talk | contribs) |
||
(7 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
= 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 domUs (along with KVM based guests). |
|||
''Virt-install'' is part of the [http://virt-manager.org/ Virtual Machine Manager], a RedHat [http://et.redhat.com/ sponsored] project to create, install and manage virtual machines such as, for instance Xen DomUs or KVM guests. |
|||
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. This is usually used if |
* graphical, by using VNC, where you get the normal install experience. This is usually used if for local installs, i.e., installing a guest while being in front of the host machine; |
||
* text-based, by using the emulated serial port, where you get the console-mode installation experience. This is normally done for |
* text-based, by using the emulated serial port, where you get the console-mode installation experience. This is normally done for installing a guest on a remote systems (e.g., reached via SSH). |
||
'''NOTE:''' in this example we will install a Fedora 16 DomU onto a Fedora 17 Dom0. However, the same technique should work for installing Fedora/RHEL/CentOS, as well as other (not necessarily RH-based) distros as DomUs. |
|||
= Preparing for the Installation = |
|||
=Getting virt-install= |
|||
This portion is fairly simple - just run <pre>yum install libvirt python-virtinst</pre> and let Yum sort out the dependencies. |
|||
= |
== Getting virt-install == |
||
First we'll create a new logical volume to be used as the virtual disk for the domU: |
|||
This is very easy. On a Fedora Dom0, just run the following and let yum do his job: |
|||
<pre>yum install libvirt python-virtinst</pre> |
|||
If Dom0 is not Fedora(-ish), it shouldn't be a bit deal. It is all just a matter of finding out the package names your favorite distro ships virt-install with. |
|||
== Preparing Partitions == |
|||
Let's now create a new logical volume to be used as the virtual disk for the DomU. We will create a 20GB logical volume named "f16" inside the volume group called "vg_f17". As such, the install location will be /dev/vg_f17/f16: |
|||
<pre> |
<pre> |
||
# lvcreate -nf16 -L20G /dev/vg_f17 |
|||
Logical volume " |
Logical volume "f16" created |
||
</pre> |
</pre> |
||
To double check everything went fine: |
|||
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. |
|||
<pre> |
|||
# lvscan |
|||
... |
|||
ACTIVE '/dev/vg_f17/f16' [20.00 GiB] inherit |
|||
... |
|||
</pre> |
|||
= Starting a Graphical Install = |
|||
=Using virt-install to do a graphical installation= |
|||
There are 2 possible ways of doing a graphical install: |
There are 2 possible ways of doing a graphical install: |
||
⚫ | |||
⚫ | |||
⚫ | |||
== Doing a local graphical virt-install == |
|||
⚫ | |||
⚫ | |||
== Local Graphical Install == |
|||
⚫ | |||
<pre> |
<pre> |
||
virt-install - |
virt-install --paravirt --name f16 --ram 768 --vcpus 1 -f /dev/vg_f17/f16 --network bridge=br0 --location http://mirrors.rit.edu/fedora/linux//releases/16/Everything/x86_64/os/" |
||
</pre> |
</pre> |
||
For more information on what each parameter does, refer to the [http://linux.die.net/man/1/virt-install virt-install man page]. |
For more information on what each parameter does, refer to the [http://linux.die.net/man/1/virt-install virt-install man page]. |
||
* -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, |
After you run virt-install, something like this should appear: |
||
<pre> |
<pre> |
||
[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... |
Starting install... |
||
Retrieving file .treeinfo... | 2.8 kB 00:00 ... |
Retrieving file .treeinfo... | 2.8 kB 00:00 ... |
||
Retrieving file vmlinuz |
Retrieving file vmlinuz... | 6.7 MB 00:02 ... |
||
Retrieving file initrd |
Retrieving file initrd.img... | 74 MB 00:01 ... |
||
Creating domain... | 0 B 00:01 |
Creating domain... | 0 B 00:01 |
||
</pre> |
</pre> |
||
And then, as soon as the installer files have been downloaded, the graphical phase of the Fedora installer should start. From there, you can install Fedora as usual. |
|||
http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-02.png |
|||
⚫ | '''NOTE:''' with X11 forwarding configured properly, you can do this on a remote system as well. 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 Dom0 with: |
||
From there, you can install Fedora as usual. |
|||
<pre>ssh -X Dom0-hostname</pre> |
|||
⚫ | |||
== Remote Graphical 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. In fact, we need to tell virt-install to setup the VNC server so you can connect to it. For doing so, we specify the VNC options in the to virt-install itself, just by adding one more parameter: |
|||
<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 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. |
|||
In this case, after printing "Creating domain", you will be back to the command prompt. At that point, start a VNC client and connect to localhost:1, to see the graphical console. |
|||
⚫ | |||
⚫ | |||
=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. |
|||
= Starting a Text Install = |
|||
⚫ | |||
Just use the very same virt-install command. The only difference is that you should use <pre>--graphics none</pre> |
|||
http://pasik.reaktio.net/fedora/f13xen4tutorial/f13-01.png |
|||
⚫ | |||
⚫ | |||
⚫ | |||
=A few points about disk partitioning in the domU= |
|||
= Some Partitioning Advices = |
|||
* 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. |
||
* 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. |
* 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. |
||
[[Category:Beginners]] |
[[Category:Beginners]] |
||
[[Category:Users]] |
[[Category:Users]] |
||
Line 86: | Line 100: | ||
[[Category:Guest Install]] |
[[Category:Guest Install]] |
||
[[Category:Fedora]] |
[[Category:Fedora]] |
||
[[Category:Libvirt]] |
Latest revision as of 00:46, 1 October 2014
Virt-Install
Virt-install is part of the Virtual Machine Manager, a RedHat sponsored project to create, install and manage virtual machines such as, for instance Xen DomUs or KVM guests.
virt-install has two modes of installation:
- graphical, by using VNC, where you get the normal install experience. This is usually used if for local installs, i.e., installing a guest while being in front of the host machine;
- text-based, by using the emulated serial port, where you get the console-mode installation experience. This is normally done for installing a guest on a remote systems (e.g., reached via SSH).
NOTE: in this example we will install a Fedora 16 DomU onto a Fedora 17 Dom0. However, the same technique should work for installing Fedora/RHEL/CentOS, as well as other (not necessarily RH-based) distros as DomUs.
Preparing for the Installation
Getting virt-install
This is very easy. On a Fedora Dom0, just run the following and let yum do his job:
yum install libvirt python-virtinst
If Dom0 is not Fedora(-ish), it shouldn't be a bit deal. It is all just a matter of finding out the package names your favorite distro ships virt-install with.
Preparing Partitions
Let's now create a new logical volume to be used as the virtual disk for the DomU. We will create a 20GB logical volume named "f16" inside the volume group called "vg_f17". As such, the install location will be /dev/vg_f17/f16:
# lvcreate -nf16 -L20G /dev/vg_f17 Logical volume "f16" created
To double check everything went fine:
# lvscan ... ACTIVE '/dev/vg_f17/f16' [20.00 GiB] inherit ...
Starting a Graphical Install
There are 2 possible ways of doing a graphical install:
- Using virt-viewer on Dom0 to display the graphical console. Use this if you are right in front of Dom0 itself.
- Using VNC viewer to connect to the graphical console. Use this if you are away from Dom0, e.g., you are connecting to it via SSH.
Local Graphical Install
Start the DomU installation with:
virt-install --paravirt --name f16 --ram 768 --vcpus 1 -f /dev/vg_f17/f16 --network bridge=br0 --location http://mirrors.rit.edu/fedora/linux//releases/16/Everything/x86_64/os/"
For more information on what each parameter does, refer to the virt-install man page.
After you run virt-install, something like this should appear:
Starting install... Retrieving file .treeinfo... | 2.8 kB 00:00 ... Retrieving file vmlinuz... | 6.7 MB 00:02 ... Retrieving file initrd.img... | 74 MB 00:01 ... Creating domain... | 0 B 00:01
And then, as soon as the installer files have been downloaded, the graphical phase of the Fedora installer should start. From there, you can install Fedora as usual.
NOTE: with X11 forwarding configured properly, you can do this on a remote system as well. 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 Dom0 with:
ssh -X Dom0-hostname
Remote Graphical Install
This step only involves getting a VNC client on your system, followed by changing the virt-install command. In fact, we need to tell virt-install to setup the VNC server so you can connect to it. For doing so, we specify the VNC options in the to virt-install itself, just by adding one more parameter:
--graphics vnc,listen=0.0.0.0,port=5901 --noautoconsole
In this case, after printing "Creating domain", you will be back to the command prompt. At that point, start a VNC client and connect to localhost: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 tells you what address to connect to when it quits though.
Starting a Text Install
Just use the very same virt-install command. The only difference is that you should use
--graphics none
This way, virt-install will take 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:
For there, again, just follow the install instructions of the specific DomU distribution.
Some Partitioning Advices
- 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.