Virtualization With Xen On CentOS 6.2 (x86_64) (Paravirtualization & Hardware Virtualization) - Page 3
4.3 Using virt-manager To Create & Manage Virtual Machines
Instead of using VNC or a text-based installer, we can use virt-manager on a Linux desktop to create and manage virtual machines. In this example, I'm using a Fedora 16 desktop.
Initialize a new VM on the CentOS 6.2 host (in this example, it's vm06):
virt-install --prompt --network bridge=br0 --virt-type=xen --vnc --noautoconsole
The --vnc --noautoconsole parameters are important - they allow us to connect to the installer with virt-manager.
[[email protected] ~]# virt-install --prompt --network bridge=br0 --virt-type=xen --vnc --noautoconsole
Would you like a fully virtualized guest (yes or no)? This will allow you to run unmodified operating systems.
What is the name of your virtual machine?
How much RAM should be allocated (in megabytes)?
What would you like to use as the disk (file path)?
How large would you like the disk (/var/lib/libvirt/images/vm06.img) to be (in gigabytes)?
What is the install URL?
Retrieving file .treeinfo... | 798 B 00:00 ...
Retrieving file vmlinuz... | 7.5 MB 00:01 ...
Retrieving file initrd.img... | 59 MB 00:10 ...
Allocating 'vm06.img' | 10 GB 00:00
Creating domain... | 0 B 00:01
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
[[email protected] ~]#
As you see the command returns to the prompt, so we must use virt-manager now to complete the VM installation.
You can install virt-manager as follows on a Fedora 16 desktop - open a terminal and become root:
Then install virt-manager:
yum install virt-manager openssh-askpass
Go to Applications > System Tools > Virtual Machine Manager to start virt-manager:
When you start virt-manager for the first time, you will most likely see the following message (Packages required for KVM usage). You can ignore this because we don't want to connect to the local libvirt daemon, but to the one on our CentOS 6.2 Xen host. Click on No...
... and go to File > Add Connection... to connect to our CentOS 6.2 Xen host:
Select Xen as Hypervisor, then check Connect to remote host, select SSH in the Method drop-down menu, type in root as the Username and the hostname (server1.example.com) or IP address (192.168.0.100) of the CentOS 6.2 Xen host in the Hostname field. Then click on Connect:
If this is the first connection to the remote Xen server, you must type in yes and click on OK:
Afterwards type in the root password of the CentOS 6.2 Xen host:
You should see vm06 as running. Mark that guest and click on the Open button to open the graphical console of the guest:
Type in the root password of the Xen host again:
You should now be connected to the graphical console of the guest and see the CentOS installer:
Now install CentOS as you would normally do on a physical system. Please note that at the end of the installation, the CentOS guest needs a reboot. The guest will then stop, so you need to start it again, either with virt-manager or like this on our CentOS 6.2 Xen host command line:
CentOS 6.2 Xen Host:
virsh start vm06
Afterwards, you can connect to the guest again with virt-manager and configure the guest. If you install OpenSSH in the guest, you can connect to it with an SSH client (such as PuTTY).