DomU Install with Virt-Manager: Difference between revisions

From Xen
Jump to navigationJump to search
(Added to Xen category)
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
== Installing new Xen guests using graphical virt-manager GUI ==
Virt-manager is not part of Xen, but it's developed by Redhat and included in Fedora, and it can be used to manage Xen hypervisor, among others. Before trying to install new guests using virt-manager make sure you have installed virt-manager and its related packages.
Virt-manager is not part of Xen, but it's developed by Redhat and included in Fedora, and it can be used to manage Xen hypervisor, among others. Before trying to install new guests using virt-manager make sure you have installed virt-manager and its related packages.


This tutorial was done using a Fedora 13 host. However, it should work fine for later Fedora releases.
This tutorial was done using a Fedora 13 host, installing a paravirtualised CentOS 5.5 x86 (32bit) domU. However, it should work fine for other Fedora/CentOS releases.


= Getting virt-manager =
We're going to use LVM volumes to store the Xen guest virtual disks. In this example we're going to install CentOS 5.5 x86 (32bit) Xen PV guest.
This portion is fairly simple - just run <pre>yum install libvirt virt-manager</pre> and let Yum sort out the dependencies.


= Getting the disk set up =
First verify the name of your LVM volume group. The LVM volume group was set up during Fedora 13 (Xen dom0 host) installation.
We're going to use LVM volumes to store the Xen guest virtual disks. In this example we're going to


First verify the name of your LVM volume group. The LVM volume group was set up [[Fedora_13_Xen_4_Tutorial|during dom0 host installation]].
<pre><nowiki>

<pre>
[root@f13 ~]# vgdisplay
[root@f13 ~]# vgdisplay
--- Volume group ---
--- Volume group ---
Line 30: Line 33:
Free PE / Size 11896 / 371.75 GiB
Free PE / Size 11896 / 371.75 GiB
VG UUID 5dsak7-VN89-zMFT-9ZiU-XGhY-s5is-u1vCUw
VG UUID 5dsak7-VN89-zMFT-9ZiU-XGhY-s5is-u1vCUw
</nowiki></pre>
</pre>


In this example the LVM volume group is called "vg_f13" and it has 371.75 GB of free space in it.
In this example the LVM volume group is called "vg_f13" and it has 371.75 GB of free space in it.
Line 36: Line 39:
Now let's create a new LVM volume to store the virtual machine virtual disk. Size of the new LVM volume will be 20 GB:
Now let's create a new LVM volume to store the virtual machine virtual disk. Size of the new LVM volume will be 20 GB:


<pre>

<pre><nowiki>
[root@f13 ~]# lvcreate -ncentos55 -L20G /dev/vg_f13
[root@f13 ~]# lvcreate -ncentos55 -L20G /dev/vg_f13
Logical volume "centos55" created
Logical volume "centos55" created
</nowiki></pre>
</pre>


Verify the newly created LVM volume:
Verify the newly created LVM volume:


<pre>

<pre><nowiki>
[root@f13 ~]# lvdisplay /dev/vg_f13/centos55
[root@f13 ~]# lvdisplay /dev/vg_f13/centos55
--- Logical volume ---
--- Logical volume ---
Line 61: Line 62:
- currently set to 256
- currently set to 256
Block device 253:2
Block device 253:2
</nowiki></pre>
</pre>


= Starting the Install
Then let's start the graphical virt-manager. First make sure your ssh X11 forwarding is working properly.
Now, let's start the graphical virt-manager.


<pre>

<pre><nowiki>
[root@f13 ~]# virt-manager &
[root@f13 ~]# virt-manager &
[1] 2126
[1] 2126
</nowiki></pre>
</pre>


And then virt-manager window will show up on your graphical desktop.
And then virt-manager window will show up on your graphical desktop.

If this is the first time you have brought up virt-manager, you need to connect to your Xen instance :
* click on "File"
* click on "Add Connection"
* select "Xen" as the Hypervisor
* if the virt-manager is not running on the same machine as xen : check "Connect to remote host" and fill in the connection information.
* check Autoconnect
* click on "Connect" button

Now you should see "xen" tree with installed domains.


http://pasik.reaktio.net/fedora/f13xen4tutorial/virt-manager01.png
http://pasik.reaktio.net/fedora/f13xen4tutorial/virt-manager01.png



Start the installation from virt-manager:
Start the installation from virt-manager:
Line 79: Line 91:
* Right-click "localhost (Xen)"
* Right-click "localhost (Xen)"
* Choose "New"
* Choose "New"
* Enter the name for the guest: centos55
* Enter the name for the guest - We're using centos55 for this.
* Choose: "Network install (HTTP, FTP, or NFS)"
* Choose: "Network install (HTTP, FTP, or NFS)"
* Enter the CentOS mirror URL: http://ftp.funet.fi/pub/mirrors/centos.org/5.5/os/i386/
* Enter the CentOS mirror URL: http://ftp.funet.fi/pub/mirrors/centos.org/5.5/os/i386/ - You can choose a different mirror, ideally one that's geographically close to you.
* Click Forward
* Click Forward
* Accept the default values for RAM and VCPUs (512 MB and 1 vcpu) and click Forward.
* Accept the default values for RAM and VCPUs (512 MB and 1 vcpu) and click Forward.
* Choose "Select managed or other existing storage"
* Choose "Select managed or other existing storage"
* Enter the path to the LVM volume to the text field or choose browse: /dev/vg_f13/centos55
* Enter the path to the LVM volume to the text field or choose browse: /dev/vg_f13/centos55 - This is the LV that we set up earlier.
* click Forward
* click Forward
* Choose/open "Advanced options"
* Choose/open "Advanced options"
Line 95: Line 107:
* New window opens with the guest VM console in it, and the CentOS5 installer starts.
* New window opens with the guest VM console in it, and the CentOS5 installer starts.
* Choose "dhcp" for IPv4 networking and you'll get private IP from the dnsmasq service running in dom0. Network connections from the guest VM will be NATed to the internet.
* Choose "dhcp" for IPv4 networking and you'll get private IP from the dnsmasq service running in dom0. Network connections from the guest VM will be NATed to the internet.
CentOS 5 installer starts in the text mode and asks for the language, keyboard and network settings: http://pasik.reaktio.net/fedora/f13xen4tutorial/centos55-01.png
CentOS 5 installer starts in the text mode and asks for the language, keyboard and network settings:
http://pasik.reaktio.net/fedora/f13xen4tutorial/centos55-01.png


When the CentOS5 installer is running you can verify the networking by checking the bridge status:
When the CentOS5 installer is running you can verify the networking by checking the bridge status:


<pre>

<pre><nowiki>
[root@f13 ~]# xm list
[root@f13 ~]# xm list
Name ID Mem VCPUs State Time(s)
Name ID Mem VCPUs State Time(s)
Line 109: Line 121:
bridge name bridge id STP enabled interfaces
bridge name bridge id STP enabled interfaces
virbr0 8000.feffffffffff yes vif1.0
virbr0 8000.feffffffffff yes vif1.0
</nowiki></pre>
</pre>


Here you can see the guest called "centos55" has ID 1. Interface "vif1.0" (the first network interface of the guest with ID 1) is attached to the bridge "virbr0" - the bridge that dnsmasq is serving and providing DHCP server and NAT service.
Here you can see the guest called "centos55" has ID 1. Interface "vif1.0" (the first network interface of the guest with ID 1) is attached to the bridge "virbr0" - the bridge that dnsmasq is serving and providing DHCP server and NAT service.


You can verify the private NAT IP assigned to the "centos55" guest VM from "/var/log/messages":
You can check the private NAT IP assigned to the "centos55" guest VM in "/var/log/messages" on the dom0:


<pre>

<pre><nowiki>
[root@f13 ~]# grep dnsmasq-dhcp /var/log/messages
[root@f13 ~]# grep dnsmasq-dhcp /var/log/messages
Sep 4 23:28:05 f13 dnsmasq-dhcp[1929]: DHCP, IP range 192.168.122.2 -- 192.168.122.254, lease time 1h
Sep 4 23:28:05 f13 dnsmasq-dhcp[1929]: DHCP, IP range 192.168.122.2 -- 192.168.122.254, lease time 1h
Line 123: Line 134:
Sep 4 23:59:44 f13 dnsmasq-dhcp[1929]: DHCPREQUEST(virbr0) 192.168.122.144 00:16:36:d4:07:b7
Sep 4 23:59:44 f13 dnsmasq-dhcp[1929]: DHCPREQUEST(virbr0) 192.168.122.144 00:16:36:d4:07:b7
Sep 4 23:59:44 f13 dnsmasq-dhcp[1929]: DHCPACK(virbr0) 192.168.122.144 00:16:36:d4:07:b7
Sep 4 23:59:44 f13 dnsmasq-dhcp[1929]: DHCPACK(virbr0) 192.168.122.144 00:16:36:d4:07:b7
</nowiki></pre>
</pre>


When the installer is finished downloading files from the mirror site it'll start the graphical phase of the installation:
When the installer is finished downloading files from the mirror site, it'll start the graphical phase of the installation:


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


Install CentOS 5 as usual.
Install CentOS 5 as usual.

Note: This can be done over an SSH connection if you enable X11 forwarding.


[[Category:Beginners]]
[[Category:Beginners]]
Line 135: Line 148:
[[Category:Tutorial]]
[[Category:Tutorial]]
[[Category:Xen]]
[[Category:Xen]]
[[Category:Guest Install]]
[[Category:Fedora]]
[[Category:Libvirt]]
[[Category:GUI]]

Latest revision as of 14:25, 24 October 2014

Virt-manager is not part of Xen, but it's developed by Redhat and included in Fedora, and it can be used to manage Xen hypervisor, among others. Before trying to install new guests using virt-manager make sure you have installed virt-manager and its related packages.

This tutorial was done using a Fedora 13 host, installing a paravirtualised CentOS 5.5 x86 (32bit) domU. However, it should work fine for other Fedora/CentOS releases.

Getting virt-manager

This portion is fairly simple - just run

yum install libvirt virt-manager

and let Yum sort out the dependencies.

Getting the disk set up

We're going to use LVM volumes to store the Xen guest virtual disks. In this example we're going to

First verify the name of your LVM volume group. The LVM volume group was set up during dom0 host installation.

[root@f13 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_f13
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               463.75 GiB
  PE Size               32.00 MiB
  Total PE              14840
  Alloc PE / Size       2944 / 92.00 GiB
  Free  PE / Size       11896 / 371.75 GiB
  VG UUID               5dsak7-VN89-zMFT-9ZiU-XGhY-s5is-u1vCUw

In this example the LVM volume group is called "vg_f13" and it has 371.75 GB of free space in it.

Now let's create a new LVM volume to store the virtual machine virtual disk. Size of the new LVM volume will be 20 GB:

[root@f13 ~]# lvcreate -ncentos55 -L20G /dev/vg_f13
  Logical volume "centos55" created

Verify the newly created LVM volume:

[root@f13 ~]# lvdisplay /dev/vg_f13/centos55
  --- Logical volume ---
  LV Name                /dev/vg_f13/centos55
  VG Name                vg_f13
  LV UUID                dP41hL-B0MI-Fy4R-ScCI-0w7K-2cfV-ruJRG2
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                20.00 GiB
  Current LE             640
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

= Starting the Install Now, let's start the graphical virt-manager.

[root@f13 ~]# virt-manager &
[1] 2126

And then virt-manager window will show up on your graphical desktop.

If this is the first time you have brought up virt-manager, you need to connect to your Xen instance :

  • click on "File"
  • click on "Add Connection"
  • select "Xen" as the Hypervisor
  • if the virt-manager is not running on the same machine as xen : check "Connect to remote host" and fill in the connection information.
  • check Autoconnect
  • click on "Connect" button

Now you should see "xen" tree with installed domains.

virt-manager01.png


Start the installation from virt-manager:

  • Right-click "localhost (Xen)"
  • Choose "New"
  • Enter the name for the guest - We're using centos55 for this.
  • Choose: "Network install (HTTP, FTP, or NFS)"
  • Enter the CentOS mirror URL: http://ftp.funet.fi/pub/mirrors/centos.org/5.5/os/i386/ - You can choose a different mirror, ideally one that's geographically close to you.
  • Click Forward
  • Accept the default values for RAM and VCPUs (512 MB and 1 vcpu) and click Forward.
  • Choose "Select managed or other existing storage"
  • Enter the path to the LVM volume to the text field or choose browse: /dev/vg_f13/centos55 - This is the LV that we set up earlier.
  • click Forward
  • Choose/open "Advanced options"
  • Change "Architecture" to "i686" as we're installing 32bit PAE guest VM.
  • Make sure the Network selection has "Virtual network 'default': NAT" selected (it is as a default).
  • Virt-type should be "xen (paravirt)"
  • Click Finish.
  • "Creating virtual machine" window opens, and virt-manager fetches the kernel/initrd from the mirror site.
  • New window opens with the guest VM console in it, and the CentOS5 installer starts.
  • Choose "dhcp" for IPv4 networking and you'll get private IP from the dnsmasq service running in dom0. Network connections from the guest VM will be NATed to the internet.

CentOS 5 installer starts in the text mode and asks for the language, keyboard and network settings: centos55-01.png

When the CentOS5 installer is running you can verify the networking by checking the bridge status:

[root@f13 ~]# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  1017     4     r-----    267.8
centos55                                     1   512     1     -b----     17.9

[root@f13 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
virbr0          8000.feffffffffff       yes             vif1.0

Here you can see the guest called "centos55" has ID 1. Interface "vif1.0" (the first network interface of the guest with ID 1) is attached to the bridge "virbr0" - the bridge that dnsmasq is serving and providing DHCP server and NAT service.

You can check the private NAT IP assigned to the "centos55" guest VM in "/var/log/messages" on the dom0:

[root@f13 ~]# grep dnsmasq-dhcp /var/log/messages
Sep  4 23:28:05 f13 dnsmasq-dhcp[1929]: DHCP, IP range 192.168.122.2 -- 192.168.122.254, lease time 1h
Sep  4 23:59:44 f13 dnsmasq-dhcp[1929]: DHCPDISCOVER(virbr0) 00:16:36:d4:07:b7
Sep  4 23:59:44 f13 dnsmasq-dhcp[1929]: DHCPOFFER(virbr0) 192.168.122.144 00:16:36:d4:07:b7
Sep  4 23:59:44 f13 dnsmasq-dhcp[1929]: DHCPREQUEST(virbr0) 192.168.122.144 00:16:36:d4:07:b7
Sep  4 23:59:44 f13 dnsmasq-dhcp[1929]: DHCPACK(virbr0) 192.168.122.144 00:16:36:d4:07:b7

When the installer is finished downloading files from the mirror site, it'll start the graphical phase of the installation:

centos55-02.png

Install CentOS 5 as usual.

Note: This can be done over an SSH connection if you enable X11 forwarding.