Creating a CentOS 6 KVM Virtual Machine

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


Purchase and download the full PDF, ePub & Kindle versions of this CentOS 6 eBook for only $9.99
Kindle/ePub/PDF edition contains 39 chapters and over 240 pages.

Buy eBook


KVM based virtual machines can easily be configured on CentOS 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 a CentOS 6 host.

The command-line approach to virtual machine creation will be covered in the next chapter entitled Creating CentOS 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 CentOS 6 virt-manager


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:


Creating a new CentOS 6 KVM virtual machine


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 media 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):


CentOS 6 KVM guest os type and media selection


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:


CentOS 6 KVM guest memory and CPU settings


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:


Allocating storage to a new KVM based guest


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 select bridged networking (where the virtual machine has direct access to a host network adapter) if configured as outlined in Creating a CentOS 6 KVM Networked Bridge Interface and to configure a specific MAC address if required:


Configuring the network for a new CentOS 6 hosted KVM guest


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:


A virtual machine listed as running in the virt-manager console


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 in a CentOS 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 CentOS 6 based KVM Guest Systems.


Purchase and download the full PDF, ePub & Kindle versions of this CentOS 6 eBook for only $9.99
Kindle/ePub/PDF edition contains 39 chapters and over 240 pages.

Buy eBook



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