In this article we will cover some basics of Xen such as; creating virtual machines via command line and using the virtual manager which provides a graphical user interface (GUI), administering each virtual machines and connecting to each machine via VNC. In this article we will be using full virtualization and not paravirtualization. If you are unsure that your machine supports full virtualization you can check the XEN hardware computability list .
“The Xen hypervisor offers a powerful, efficient and secure feature set for virtualization of x86, x86_64, IA64, PowerPC and other CPU architectures, and has been used to virtualize a wide range of guest operating systems, including Windows, Linux, Solaris and various versions of the BSD operating systems” (Xen, 2008).
The first step that is required is to install the Xen utilities and Xen kernel, The command we will use to start the installation process is “yast sw_single“. Once the installation screen appears you should be able to see the option “Filter” in the top left corner. Select this menu and when the drop down menu appears select “Patterns”. Once the package categories appear select “Xen Virtual Machine Host Server” as shown in Figure 1.
Once you have installed the package group you can reboot your machine and select your new Xen kernel.
The Xen daemon configuration file is located within the “/etc/xen” directory called: “xend-config.sxp”. This configuration file allows you to set directives for “logging”, “networking”, “core dumps when gust domain crashes”, “VNC username/password” and many others. In this article we will just be enabling VNC on the local loopback interface and setting a default password for all domU instances.
The directive that needs to be uncommented within the “xend-config.sxp” is “(vnc-listen ‘127.0.0.1’)”. This directive will create a VNC session for each domU instance which is good if you are using Microsoft Windows. The second directive that needs to be uncommented is “(vncpasswd ”)”. This directive is used to set a global VNC password which will be set for each domU instance thus tightening security.
When you alter the “xend-config.sxp” you have to restart the xend daemon including each domU instance as shown in Figure 2.
linux-l4kc:~ # service xend restart
Figure 2: Restarting the Xen daemon.
Installing Microsoft Windows via virtual manager
The installation of Microsoft Windows requires full virtualization to be enabled. The machine that I was working with had to have virtualization turned on from within the BIOS. Once you have enabled virtualization you can begin with the installation of Microsoft Windows. From the command line issue the “virt-manager” command and you will be prompted with an assistance window as shown in Figure 3.
Once the assistance window appears you can click forward. The next window you will be asked how to install your operating system. There are two options available, option one “I need to install an operating system” which will install an operating system from scratch, and the second option is “I have a disk or disk image with an installed operating system”. This option allows you to use a virtual machine that you may already have. In this article we will just go with “I need to install and operating system”.
The next window will ask you to select which operating system you would like to install. We will install Microsoft Windows 2003 as shown in Figure 3.1.
Once you have selected the operating system, click the forward button and you will be presented with a summary of your virtual machine. The summary page will allow you to tweak your virtual machine as shown in Figure 3.2.
When you are at the summary window you can click on one of the sections highlighted in blue to alter it’s properties. One field that is required to be altered is the “Operating System Installation”. You will need to set an installation source, we will use the CD-ROM. Once you have clicked on the “Operating System Installation” section you will be presented with a new window allowing you to add a virtual disk. Click the “Add” button and you will be able to add the CD-ROM as shown in Figure 3.3.
Once you have clicked “OK” you should be able to click “Apply” and you will be brought back to the summary page. When you get back to the summary page click “OK” to begin the installation as shown in Figure 3.4.
Once the installation is complete your Microsoft Windows 2003 machine will be ready for use.
Installing Microsoft Windows via command line
In this section we will install Microsoft Windows 2003 from the command line. The first command we need to issue is “vm-install“. Once you have issued this command you will be asked a sequence of questions. Table 1 shows the questions asked with the corresponding answer.
|Operating system list||I selected number 21 which is for Windows XP, 2000 and 2003.|
|Please choose a name for the virtual machine||I gave the name “Win2003”.|
|Virtual Processors ||1|
|Please specify the type of virtualized graphics hardware||I selected my graphics card.|
|Do you want to add another virtual disk?||I selected “YES” then select the disk type of “CD-ROM or DVD” and then provided the CD-ROM drive “/dev/cdrom”. I was then asked the question again and I selected “YES” again and then selected “Hard Disk” and provided the path to where I wanted my virtual machine stored.|
|Do you want to add another virtual network adapter?||I selected “YES” and selected my network card from the list of detected cards.|
Table 1: Virtual machine questions and answers.
Once you have finished answering all the questions the installation will begin. The installation requires you to VNC into your virtual machine as shown in Figure 3.5.
Connecting to a virtual machine via VNC
Once you have a domU instance installed and have configured the xend daemon for VNC connections you can connect to your domU instances, however if you have more than one domU instance you will need to find out which port VNC is bound to. This can be resolved simply by issuing the “xenstore-ls” command and using the “grep” utility to filter out the VNC port as shown in Figure 4.
Linux-l4kc:~ # xenstore-ls | grep “name = \”WindowsXP\”” | -B 2 | tail -n 3 vnc-port = “5900” tty = “/dev/pts/4” name = “WindowsXP”
Figure 4: Retrieving WindowsXP VNC port.
In Figure 4 the domU instance we searched for was “WindowsXP”, if you use the above command you may need to replace “WindowsXP” with the name of your domU instance.
Once you have the VNC port number you can simply issue the following command “krdc 127.0.0.1:5900”. If you don’t have “krdc” you can try “vncviewer 127.0.0.1:5900” however, I did encounter a few problems with this client.
The Xen virtualization technology is very impressive, it provides a wide range of supported operating systems including Microsoft Windows and Sun Solaris, however, I did notice while emulating SUSE Linux Enterprise Server 10 SP1 that the mouse occasionally struggled to move to certain parts of the screen, this was easily fixed when I moved the mouse about.