Virtualization with Xen: How to create virtual machines

In this installment of Sander van Vugt's Xen series, you'll learn how to create virtual machines with the Virtual Manager utility.

In the first two parts in this series about Xen, you've read about what Xen is and how to prepare SUSE Linux Enterprise Server for Xen virtualization. Based on that information, you should have a server that is ready and waiting for virtual machine creation. In this installment of my Xen series, you'll learn how to create virtual machines with the Virtual Machine Manager utility.

The procedure of setting up virtual machines is rather different between the Linux distributions. For example, Ubuntu server offers xen-tools, a tough command line solution in which you have to create a configuration file and use commands with many options (more about that in the next article). On the contrary, Red Hat and SUSE make virtualization easy with the graphical Virtual Machine Manager utility.

Virtual Machine Manager works for both para- and fully virtualized environments. After creating the machine with Virtual Machine Manager, you can launch and monitor the VM (virtual machine) from this utility as well. However, some of the more advanced options are not available from Virtual Machine Manager. Examples are the option to migrate a virtual machine between nodes, or creation of a high availability solution.

How to create a virtual machine with Xen
In the following procedure you'll learn how to install an instance of paravirtualized SUSE Linux Enterprise Server 10 SP1 on top of a SUSE Linux Enterprise 10 SP1 virtualization host.

1. Make sure that your server has booted the Xen kernel. Next, run the virt-manager command to start Virtual Machine Manager. This will give you an interface, as in figure 1.

 


Figure 1: Virtual Machine Manager provides an interface to all virtual machines on one physical server.

2. From the Virtual Machine Manager interface, click New. This start the virtual machine creation wizard. From the start window of this wizard, click Forward.

3. The wizard now asks what you want to do. If you need to install a brand new operating system, select "I need to install an operating system." If you want to use a disk or disk image on which the operating system has been pre-installed, select "I have a disk or disk image with an installed operating system," as in figure 2.

 


Figure 2: Select I need to install an operating system to start installation of a new virtual machine.

4. From the list of available operating systems, select SUSE Linux Enterprise Server 10 and click Forward. You'll now see the summary window as in figure 3.

 


Figure 3: From the summary window you can configure the complete virtual machine.

*Note: When choosing an operating system to install as a virtual machine, try to select an operating system that you can install from a DVD instead of CD's. In the current version of SUSE Linux Enterprise Server, Xen has a problem installing from CD's. The alternative is to configure an installation server to install the operating system of your choice.

5. In the summary window, several installation options are available. First, under Virtualization Method you can select the kind of virtualization you want to use. If your CPU has virtualization support, select "Full virtualization." If it doesn't, "Paravirtualization" is your only choice. SUSE Linux Enterprise Server 10 SP1 can be installed as a paravirtualized operating system without difficulty, but not all operating systems offer that possibility.

6. Next, select the name of the virtual machine. If you don't enter a name yourself, the installer will create a name for you.

7. Now click the "Hardware" link to configure memory and CPU. When configuring memory, you'll notice a difference between Initial Memory and Maximum Memory. The initial memory is the memory that is allocated to a virtual machine when it first boots. I recommend to set that to a relatively low value, as it can be increased easily. The maximum amount of memory is the amount of memory that the virtual machine can use as a maximum. This is not a dynamic allocation; it just specifies the upper limit. There is no problem setting it equal to the amount of RAM you have in your server. Next, select the amount of virtual processors the machine can use. It makes no sense to set the amount of virtual CPU's higher than the amount of available processors, but if you want to see what it looks like to have 32 processors -- the maximum amount that is possible -- on a physical machine that has one CPU only, you can specify that here.

 


Figure 4: Both the amount of memory and the amount of CPU's available to a virtual machine can be changed easily later.

8. As for the graphics adapter, a paravirtualized graphics adapter is used as a default. This adapter performs fine, so there is no need to change it in most cases.

9. One of the most important choices when setting up a virtual machine is the disk that you want to use. The default choice of the installer is to create a disk image file in the directory /var/lib/xen/images. This is fine, but for performance reasons, it's a good idea to set up LVM volumes and use an LVM volume as the virtualized disk. To keep setting up the virtual machine easy, in this article we'll configure a virtual disk based on a disk image file. Click the link Disks. This gives an overview in which you can see the disk that the installer has created for you.

 


Figure 5: Both the amount of memory and the amount of CPUs available to a virtual machine can be changed easily later.

*Note: Here's a tip. Want to use your virtual machines in a data center? Put the disk image files on the SAN, which makes migrating a virtual machine to another host much easier!

10. To change disk properties, such as the size or location of the disk file, select the virtual disk and click "Edit." Change the disk properties according to your needs now.

11. As you can see in figure 5, the installation wizard doesn't give you access to an optical drive by default. You may want to set this up anyway, if only to be able to perform the installation from the installation DVD! Click CD-ROM and select the medium you want to use as the optical drive within the virtual machine. By default this is /dev/cdrom on the host operating system. If you want to install from an ISO file, use the Open button to browse to the location of the ISO file.

 


Figure 6: It is easy to select an ISO-file instead of a physical CD-rom.

12. In the Network Adapters part of the summary window, you'll see that a paravirtualized network adapter has been added automatically. We'll talk about network adapters later, so let's just keep it this way now.

13. Now check that under Operating System Installation an installation source is mentioned. If it is, it's time to click OK and deploy of your virtual machine.

After installing the virtual operating system, you can access it from Virtual Machine Manager. Later in this series, you'll read more about all the managent options you have from this interface and the command line as well.

Sander van Vugt is an author and independent technical trainer, specializing in Linux since 1994. Vugt is also a technical consultant for high-availability (HA) clustering and performance optimization, as well as an expert on SLED 10 administration. 
 

This was first published in October 2007

Dig deeper on Citrix XenServer

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchVMware

SearchWindowsServer

SearchCloudComputing

SearchVirtualDesktop

SearchDataCenter

Close