LinuxTutorialsUbuntu

How To Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

In this tutorial, we will show you how to install and configure KVM and Create Virtual Machines on Ubuntu 16.04 LTS. For those of you who didn’t know, Kernel-based Virtual Machine (KVM) is free and open-source virtualization software. You can create multiple VM (virtual machines), each VM has its own private virtualized hardware like a disk, CPU, RAM, etc.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of KVM and Create Virtual Machines on a Ubuntu 16.04 (Xenial Xerus) server.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 16.04 (Xenial Xerus).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

Step 1. First, make sure that all your system packages are up-to-date by running the following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing KVM.

First, let us check if your system supports hardware virtualization. To do so, run the following command:

egrep -c ‘(svm|vmx)’ /proc/cpuinfo

A 0 indicates that your CPU doesn’t support hardware virtualization, while a 1 or more indicates that it does. You may still have to enable hardware virtualization support in your computer’s BIOS, even if this command returns a 1 or more.

Install KVM and other required packages to set up a virtualization environment in Linux:

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

The bridge-utils is used to create bridge networking so other devices on your network can see your virtual machine.

Verify the KVM installation:

virsh -c qemu:///system list

After running this command, log out and log back in. Run this command after logging back in and you should see an empty list of virtual machines. This indicates that everything is working correctly.

Step 3. Create Virtual Machines.

You can open the Virtual Machine Manager by typing the same in Dash Home. Click the icon, it will open the application.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

In the virtual machine manager window, click the first icon in the toolbar.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

Next, choose the location of your installation media.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

You can install it from a disc, ISO image, or even a network location.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

Next, allocate memory and CPU to your virtual machine.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

After that, specify the size of your virtual disk. If you check the box before allocate the entire disk now, then the disk size is fixed.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

In the next window, you can give your virtual machine a name. Then click finish to begin installing OS to your virtual machine.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

Here’s a screenshot of the Ubuntu virtual machine running in virt-manager window.

Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

Congratulations! You have successfully installed KVM. Thanks for using this tutorial for installing KVM and Create Virtual Machines on Ubuntu 16.04 LTS  (Xenial Xerus) system. For additional help or useful information, we recommend you check the official KVM website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button