Creating an RHEL 6 KVM Virtual Machine

From Techotopia
Jump to: navigation, search
PreviousTable of ContentsNext
Creating an RHEL 6 KVM Networked Bridge InterfaceCreating RHEL 6 Hosted KVM Virtual Machines with virt-install and virsh

Purchase and download the full PDF and ePub versions of this RHEL 6 eBook for only $9.99
PDF/ePub edition contains 40 chapters and over 250 pages.

KVM based virtual machines can easily be configured on Red Hat Enterprise Linux 6 using either the virt-install command-line tool, or the virt-manager GUI tool. For the purposes of this chapter we will use the virt-manager tool to install Windows 7 as a KVM guest on an RHEL 6 host.

The command-line approach to virtual machine creation will be covered in the next chapter entitled Creating RHEL 6 Hosted KVM Virtual Machines with virt-install and virsh.

Starting the Virtual Machine Manager

Begin by launching virt-manager either by selecting the Applications -> System Tools -> Virtual Machine Manager menu option, or from the command-line in a terminal window by running virt-manager. If virt-manager fails to start with a message that reads “Unable to open connection to the libvirt management daemon” it will be necessary to open a terminal window (Applications -> System Tools -> Terminal) and run the following commands before attempting to start virt-manager once again:

su –
/sbin/service libvirtd start

Once loaded, the virtual machine manager will prompt for the root password prior to displaying the following screen:

The virt-manager tool running on RHEL 6

The main virt-manager screen lists the current virtual machines running on the system. At this point there should only be one, the hypervisor running on the host system. By default the manager should be connected to the host. If it is not, connect to the host system by right clicking on the entry in the list and selecting Connect from the popup menu.

To create a new virtual system, click on the new virtual machine button (the far left button on the toolbar) or right click on the hypervisor entry and select New from the resulting menu to display the first screen of the New VM wizard. In the Name field enter a suitably descriptive name for the virtual system. On this screen, also select the location of the media from which the guest operating system will be installed. This can either be a CD or DVD drive, an ISO image file accessible to the local host, a network install using HTTP, FTP, NFS or PXE or the disk image from an existing virtual machine: <google>RHEL6BOX</google>

Configuring the name and installation media of an RHEL 6 KVm virtual machine guest

Note that beneath the Name field the dialog displays the connection type (QEMU/KVM in this case). If the connection on your system is displayed as QEMU your system either does not have Intel-VT or AMD-V support, or these features have been disabled in the BIOS. That being the case your guest operating system will run inside QEMU based emulation, and will not use the faster KVM hardware based virtualization.

Configuring the KVM Virtual System

Clicking Forward will display a screen seeking additional information about the installation process. The screen displayed and information required will depend on selections made in the preceding screen. For example, if a CD, DVD or ISO was selected, this screen will ask for the specific location of the ISO file or physical device. This screen also asks that you specify the type and version of the guest operating system to be installed (for example Windows 7 or Ubuntu Linux):

Configuring an RHEL 6 KVM guest OS type and media location

Once these settings are complete, click Forward to configure CPU and memory settings. The optimal settings will depend on the number of CPUs and amount of physical memory present in the host and the requirements of other applications and virtual machines that will run in parallel with the new virtual machine:

Configuring memory and CPU for an RHEL 6 KVM based virtual machine

The last item to configure before creating the virtual machine is the storage space for the guest operating system and corresponding user data. This takes the form of a virtual disk image or pre-existing storage. A virtual disk drive is essentially an image file hosted on the file system of the host computer which is seen by the virtual machine as a physical disk drive.

Options are available to create an image disk of a specified size, select a pre-existing volume or to create a storage volume of a specified format (raw, vmdk, iso etc). Unless you have a specific need to use a particular format (for example you might need to use vmdk to migrate to a VMware based virtualization environment at a later date) or need to use a dedicated disk or partition, it is generally safe to simply specify a size on this screen. The option is also available to pre-allocate the space now. If you choose not to pre-allocate the space, space will be allocated up to the specified maximum only as it is needed by the guest operating system. This has the advantage that space on the host file system is not used until it is needed. Downsides are that performance may degrade as space is allocated in real-time and allocation will fail if another process uses up the free space on the host file system before it can be assigned to the virtual machine:

Configuring storage for an RHEL 6 virtual machine

Once these settings are configured, click the Forward key once more. The final screen displays a summary of the configuration. Review the information displayed. Advanced options are also available to configure bridged networking (where the virtual machine has direct access to a host network adapter) if configured as outlined in Creating an RHEL 6 KVM Networked Bridge Interface and to configure a specific MAC address if required:

Configuring network settings for an RHEL 6 KVm based virtual machine

Starting the KVM Virtual System

Click on the Finish button to begin the creation process. The virtualization manager will create the disk and configure the virtual machine before starting the system. The new virtual machine will appear in the main virt-manager window with the status set to Running as illustrated in the following figure:

An RHEl 6 KVm virtual machine listed as running in virt-manager

By default, the console for the virtual machine should appear in the virtual machine viewer window. To view the console of the running machine at any future time, ensure that it is selected in the virtual machine list and select the Open button from the toolbar. The virtual machine viewer should be ready for the installation process to begin:

A Windows 7 guest running inside an RHEl 6 KVM virtual machine

From this point on, simply follow the operating installation instructions to install the guest OS in the KVM virtual machine. For information on administering a virtual system read Managing and Monitoring RHEL 6 based KVM Guest Systems.

Purchase and download the full PDF and ePub versions of this RHEL 6 eBook for only $9.99
PDF/ePub edition contains 40 chapters and over 250 pages.

PreviousTable of ContentsNext
Creating an RHEL 6 KVM Networked Bridge InterfaceCreating RHEL 6 Hosted KVM Virtual Machines with virt-install and virsh