DomU Install with Virt-Manager

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.
http://pasik.reaktio.net/fedora/f13xen4tutorial/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: 
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:
[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:
http://pasik.reaktio.net/fedora/f13xen4tutorial/centos55-02.png
Install CentOS 5 as usual.
Note: This can be done over an SSH connection if you enable X11 forwarding.
Category:Beginners
Category:Users
Category:Tutorial
Category:Xen
Category:Guest Install
Category:Fedora
Category:Libvirt
Category:GUI