You need to run another operating system on your Linux PC. But should you dual boot, or use a virtual machine? And if you choose the second option, which virtual machine software should you use?
Virtual Machines vs. Dual Booting
Do you run Linux — perhaps Linux Mint or Ubuntu — alongside Windows? Or do you have two or more Linux distributions installed on your computer? How is it working out for you? For some, this dynamic works well. For others, rebooting can be a problem.
The time taken to restart, select a different OS at the GRUB bootloader screen, and then boot, can be problematic. This is especially true on systems where Linux is installed alongside Windows.
On slower systems, or those with many apps trying to run when Windows loads, you could be waiting 5–10 minutes before you can start being productive. Throw in an anti-virus solution, and you’re soon on a massive go-slow.
However, running your secondary OS in a virtual machine can overcome this problem.
What Is a Virtual Machine?
We’ve looked at virtual machines — known as VMs — several times in the past. Put simply, they are applications that create a software environment that mimics computer hardware. An operating system can then be installed into this environment. We call this a “guest OS”, while the operating system you have installed on your physical computer is the “host OS”.
Additionally, virtualization can be enhanced with the help of dedicated system hardware.
How to Activate Virtualization on Your PC
While your chosen guest OS might run without hardware virtualization, if the option is available, it is worth using. Not least because it will reduce the drain on your computer’s system resources.
To enable hardware virtualization, you’ll need to reboot your computer to access the BIOS. How this is achieved will depend upon your device, but it is generally done by tapping Del or F2 after the computer restarts.
Find the Advanced screen in the BIOS and look for one of the following:
- Hyper-V (Intel systems)
- AMD-V (AMD systems)
The BIOS is navigated using the arrow keys. When you have enabled virtualization, hit F10 to save and exit.
Once this is done, you have a choice of three open source VM applications, which we’ll look at below (VMWare is also available for Linux, but is not open source).
Offering versatile virtualization, VirtualBox can create a virtual machine with virtually any operating system (except those intended for ARM devices). It also offers software and hard assisted virtualization, storing virtual machines as disk images. This makes them easy to backup or migrate to other PCs or VM applications.
VirtualBox is particularly good at running 32-bit and 64-bit Linux distros, as well as Windows. It’s even possible to run OS X on VirtualBox, perhaps to test it before configuring your PC as a Hackintosh. Find a copy for your distribution at virtualbox.org/wiki/Downloads.
If you want to run an ARM operating system (such as Android, Raspbian, or RISC OS), then this command line-based tool is the one to choose.
Short for “Quick Emulator”, QEMU is straightforward to set up, and some guest operating systems can even be downloaded with QEMU built in. Our previous look at running the Raspbian Pi primary OS Raspbian in QEMU will give you a good introduction to this tool.
Although the unabbreviated name for QEMU is “Quick Emulator”, it is in fact a hypervisor, a tool for managing hardware virtualization. You can install QEMU with:
sudo apt-get install qemu qemu-kvm libvirt-bin
Abbreviating Kernel-based Virtual Machine, KVM is a fork of the QEMU project, and works in conjunction with that tool to provide additional options (such as near-native speed) beyond its native VM functionality.
This means that KVM offers great speed and stability than VirtualBox, but KVM is a little trickier to set up. However, if you can get your head around para-virtualized drivers, you’ll be well on your way to understanding why KVM is a popular option for hosting VMs.
To use KVM, begin by confirming that your hardware is suitable for hardware virtualization:
sudo apt-get install cpu-checker
If the response is “KVM acceleration can be used”, proceed to install the software:
sudo apt-get install qemu-kvm libvirt-bin virtinst bridge-utils
You’ll be able to run KVM via the desktop using Virtual Machine Manager, which you should find in the desktop menu.
Which Distros Run Best in a VM?
Once you’ve chosen a suitable virtual machine application, you’ll need to tailor your choice of guest OS. For instance, you can run Windows effortlessly on VirtualBox, although Windows 7 is probably the safest option.
Conversely, QEMU is suitable for running ARM-targeted distributions, such as the Raspberry Pi’s Raspbian, or Android.
Meanwhile, something lightweight like Lubuntu will run on any of these VM tools.
Which VM Tool Should You Use?
So, we’ve taken a look at three virtual machine applications. But which should you use?
It’s a tricky one. If you want easy virtualization that is quick and straightforward to set up, then VirtualBox should be your first stop. For more advanced virtualization, or to run a VM of an ARM device, then take a look at QEMU.
If you consider yourself a virtual machine power user, however, then KVM should be your first stop.
Do you prefer to dual boot, or is a virtual machine setup your preference for multi-platform desktop access? Tell us how you do it in the comments.