LOGO

Install KVM on Ubuntu: A Step-by-Step Guide

June 28, 2012
Install KVM on Ubuntu: A Step-by-Step Guide

Leveraging KVM for Virtualization on Linux

For Linux users, creating virtual machines doesn't necessitate the use of VirtualBox or VMware. An alternative solution is KVM, which stands for kernel-based virtual machine.

KVM allows the execution of both Windows and Linux operating systems within virtualized environments.

Direct Use or Graphical Interface

While KVM can be utilized directly through command-line tools, many users will find the Virtual Machine Manager (Virt-Manager) application more accessible.

Virt-Manager provides a graphical user interface, offering a similar experience to those accustomed to other virtual machine software.

Benefits of Virt-Manager

  • Familiar Interface: Virt-Manager’s GUI simplifies the process of creating and managing virtual machines.
  • Ease of Use: It abstracts away the complexities of direct KVM command-line interaction.
  • Comprehensive Control: Users can still access advanced settings and configurations as needed.

Therefore, Virt-Manager serves as an excellent front-end for KVM, making virtualization on Linux more approachable for a wider range of users.

KVM Installation Guide

Successful KVM operation requires hardware virtualization capabilities within your CPU, specifically Intel VT-x or AMD-V. To ascertain if your processor possesses these features, execute the subsequent command:

egrep -c '(svm|vmx)' /proc/cpuinfo

A result of 0 signifies a lack of hardware virtualization support. Conversely, a value of 1 or greater confirms its presence. Even with a positive result from this command, enabling hardware virtualization may still be necessary within your computer’s BIOS settings.

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-1.jpg

The installation of KVM and its associated packages can be achieved using the following command. Virt-Manager provides a user-friendly graphical interface for virtual machine management. While direct use of the kvm command is possible, libvirt and Virt-Manager streamline the overall process.

sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager

Access to KVM virtual machines is restricted to the root user and members of the libvirtd group. To grant your user account the necessary permissions, utilize this command:

sudo adduser name libvirtd

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-2.jpg

Following the execution of the preceding command, a system logout and subsequent login are required. After logging back in, run the following command to verify proper functionality. An empty list of virtual machines confirms successful installation.

virsh -c qemu:///system list

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-3.jpg

This indicates that the KVM environment is correctly configured and ready for use.

Establishing Virtual Machines

With a successful KVM installation completed, utilizing the Virtual Machine Manager application represents the most straightforward approach to leveraging its capabilities. This application can be readily located within your Dash interface.

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-4.jpg

Initiate the virtual machine creation process by clicking the "Create New Virtual Machine" button present on the toolbar. The Virtual Machine Manager will then guide you through the necessary steps. These include selecting an appropriate installation source, configuring the virtual hardware specifications, and ultimately installing your desired guest operating system.

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-5.jpg

The setup procedure should feel familiar to those with prior experience using virtualization software such as VirtualBox, VMware, or similar applications. Installation can be performed from a physical disc, an ISO image file, or even a network-based location.

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-6.jpg

A 64-bit Linux kernel is required if you intend to allocate more than 2GB of memory to a virtual machine. Systems employing 32-bit kernels are limited to a maximum RAM allocation of 2 GB for each virtual machine.

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-7.jpg

By default, KVM provides networking functionality akin to NAT with bridging. This means your virtual machine won’t be directly visible as a separate device on the network. Instead, it accesses the network through the host operating system. Adjustments to the networking configuration are necessary if you wish to make server software running within the virtual machine accessible from other devices on the network.

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-8.jpg

Following your selection of an installation method, the guest operating system will be launched within a dedicated window via Virt-Manager. The installation of the guest operating system then proceeds in a manner identical to that of a physical machine.

how-to-install-kvm-and-create-virtual-machines-on-ubuntu-9.jpg

Virtual Machine Management

The Virtual Machine Manager interface presents a comprehensive listing of all virtual machines currently installed on your system. Users can interact with these virtual machines directly within the window.

Actions such as initiating a virtual machine, performing a shutdown, creating a clone, or migrating the virtual machine to a different host can be executed by right-clicking on the desired virtual machine entry.

Accessing Virtual Machine Information

Detailed information regarding a specific virtual machine, alongside the ability to adjust its virtual hardware settings, is readily available. Simply click the information icon – represented by a lowercase 'i' – located within the virtual machine’s window.

This action opens a panel where you can review and modify the allocated resources and configurations of the virtual machine.

  • Starting and stopping virtual machines is easily accomplished.
  • Cloning allows for the creation of identical copies.
  • Migration facilitates the movement of virtual machines between hosts.

These features provide flexibility and control over your virtualized environment. Proper management ensures optimal performance and resource utilization.

#KVM#Ubuntu#virtualization#virtual machines#VM#install KVM