Cloud Computing Course #4: Creating A Virtual Machine


Cloud Computing Course #4: Creating A Virtual Machine

In the third part of this course, I introduced you  to the virtual machine manager or virt-manager. Today, I'm going to show you how to create your own virtual machine with virt-manager.

There are two ways (using virt-manager, that is . . . there are always other ways) to create a new virtual machine. One involves creating the machine from scratch, via the virt-manager interface and the other uses cloning. You, in effect, create a clone of a running virtual machine  (I'll cover cloning in the next installment of this course). Let's start by taking a look at creating a virtual machine from scratch.

From the Virtual Machine Manager, make sure you are connected then left-click the main host instance (localhost). You should see the button labeled New switch from its grayed out state to available. For the following example, I'll take you through an Ubuntu Linux installation. Click New to start the VM creation process and you'll see a window asking you to specify a name for your new VM and requesting an installation method (see Figure 1).

Figure 1 :  What will you call this new machine and how will you install it?

Step two asks you to specify the location of your installation media, whether it be an attached CD or DVD, or an ISO Image (see Figure 2). Allow me a momentary backtrack to step one before I continue. The ISO install is the method I chose, but there are others as well. For instance, you could import an existing image and install from that (in a fashion similar to that of the Amazon AMIs), boot using the local network (PXE), or boot from a network install directly from a distribution's repository.

For example, a 64 bit CentOS system could be installed using this path.

For this example, I'll use an Ubuntu Oneric (11.10) server image I downloaded to my home directory's Downloads area.

Figure 2: Select the path to your install media.

A little further down in step 2, choose the OS type (Linux) and the version you are installing; you could also choose to install Solaris, other Unix flavors, or Windows. Each OS type has multiple versions defined, so make sure you use the one that most closely matches the system you are trying to install. Click Forward to continue. You will be asked to define the amount of memory (RAM) assigned to the machine, and the number of processors (see Figure 3).

Figure 3 : Choose your memory and CPU settings.

Click Forward and it's time to define the storage space you will allocate to this VM. When you define a disk here, virt-manager will create the file for you. If a storage file already exists, or you pre-created it in some fashion, you may specify that as well. Notice the check box next to "Allocate entire disk now". If you choose this, it takes a little longer as the disk file is prepared, but the installation is quicker. Leave it off and the disk will grow to the defined maximum space as it is needed (see Figure 4).

Figure 4 : Time to allocate the storage space for our virtual machine.

Click Forward and you'll have one last chance to review your VM, including assigning networking, before actually launching the process (see Figure 5).

Figure 5 : The last step reviews the choices to date, but also lets you specify networking and virtualization options like architecture.

Click Finish again and the installer will create the disk file. Depending on the size of the file, this step may take a few minutes. Once done, you'll find yourself back at the virt-manager screen with your virtual machine in a running state. Stats on disk and CPU usage should start appearing in seconds. On a fresh install, you'll want to interact with the machine. To do so, either double-click on its entry, or right-click and select Open. By default, the VM's control panel will open with the Console button checked. This is done using a VNC viewer attached to the server process on the VM. In effect, you are connected to a graphical console from which you can continue with the installation. Figure 6 should look pretty familiar in as installation goes.

Figure 6 : Connected to the VM's VNC console, installtion proceeds as though you were right there with the real thing.

From here on in, it's pretty much the same as any machine installation. When the machine reboots, it will disconnect from the CD image and you'll be able to boot your machine normally. Pretty cool!