A GNU/Linux user actually can do machine virtualization without using Oracle VirtualBox, by just taking advantage of already included feature of Linux kernel, KVM. KVM (Kernel-based Virtual Machine) is a kernel module of Linux which enables a GNU/Linux operating system to run virtual machine of another operating system (just like VirtualBox). But because KVM is a part of the kernel (kernel module), it is very lightweight and fast (compared to VirtualBox and VMWare as external things). While KVM works in kernel-space, we use QEMU as the machine emulator for user-space. This QEMU KVM combination gives the users lightweight virtualization and good performance (but with no GUI). We can make it perfect with Red Hat Virtual Machine Manager as the GUI for QEMU KVM virtualization. QEMU, KVM, and Virtual Machine Manager are all free software. We introduce here how to install them in Ubuntu.
We are using a 32 bit laptop with Ubuntu 16.04 as the host operating system while writing this article.
sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utilsExplanation: this command needs about 15 MB data to download in Ubuntu 16.04 32 bit. Package qemu-kvm contains the basic QEMU KVM programs, package libvirt-bin contains programs for the libvirt library (the library which takes advantage from Linux kernel's virtualization feature), package ubuntu-vm-builder contains Ubuntu VM Builder scripts (to help creating ready to use virtual machine in Ubuntu), and package bridge-utils contains programs to connect your host network to the virtual machine.
Add User to Group libvirtd
For all Ubuntu version: you must do relogin after installing or adding your username to libvirtd group in your sistem. For Ubuntu 14.04 and later: you don't need to add your username to libvirtd group because that configuration happens automatically while you are installing KVM. For Ubuntu prior to 14.04 until 9.10: add your username manually to libvirtd group by this command:
sudo adduser `id -un` libvirtdor suppose your username is myname so the exact command would be:
sudo adduser myname libvirtdRemember to always do relogin after installing or adding user regarding to installation of KVM so this group configuration activated effectively.
If you want to make sure your username is already a member of libvirtd group, try this command:
groups `id -un`or suppose your username is myname so the exact command would be:
groups mynameand you should see libvirtd listed as the result like this picture.
Install A GUI for KVM
Perform below command:
sudo apt-get install virt-managerExplanation: this command needs about 12 MB data to download in Ubuntu 16.04 32 bit. Package virt-manager contains the program virt-manager, a desktop GUI tool for virtual machine from Red Hat. This program is the GUI for our QEMU KVM in this context. Think about installation of VirtualBox, but imagine VirtualBox installation splitted by installing the core component and then the GUI component. That is a close analogue for this QEMU KVM installation tutorial. Note: VirtualBox is a different product by different developer with different technology compared to QEMU KVM with virt-manager. The picture is shown below.
Without relogin, or without adding username into libvirtd group, you may see Virtual Machine Manager error like picture below. If you have followed the rest of article, you just need to relogin.