Categories
News

How to Run a Virtual Machine on Linux: 3 Different Ways

You need to run another operating system on your Linux PC. Dual booting is an option, but you could use a virtual machine.

But if you choose the second option, which Linux virtual machine software should you use?

There are two ways to run multiple operating systems on a computer:

Dual booting is good but has its downsides. For example, you can run two or more Linux distributions (perhaps Linux Mint or Ubuntu) installed on your computer. However, it doesn't work well for everyone. Various issues can frustrate the experience, such as rebooting.

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, you could be waiting 5-10 minutes before you can start being productive. With anti-virus software scanning at boot, 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?

Put simply virtual machines---known as VMs---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".

Related: What is a virtual machine?

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 check if your Linux PC can handle virtualization, open a terminal and enter:

lscpu

Look for "Virtualization"---the type your computer's CPU supports will be listed. You should see reference to VT-x, VT-d, or AMD-V.

To enable hardware virtualization, you'll need to reboot your computer to access the BIOS/UEFI. How this is achieved will depend upon your device, it's generally accessed by tapping Del or F2 after the computer restarts.

Find the Advanced screen in the BIOS and look for one of the following:

  • Virtualization
  • VT-x (Intel---older systems will have VT-d)
  • AMD-V (AMD systems)

Older BIOS environments are navigated using the arrow keys; however, menus in newer UEFIs can be accessed with a mouse. When you have enabled virtualization, hit F10 to save and exit.

Your PC will then reboot.

3 Virtual Machine Tools for Linux

With virtualization activated it's time to take a look at the a choice of Linux VM applications.

1. VirtualBox

Run a Linux VM on Virtualbox

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 hardware 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 macOS on VirtualBox, perhaps to test it before configuring your PC as a Hackintosh.

Download: VirtualBox (Free)

2. Run a Linux VM in QEMU

If you want to run an ARM operating system as your Linux VM, QEMU is the best choice. Suitable for VMs of Android, Raspbian, or the non-Linux RISC OS, this command line-based tool is quick to set up.

Short for "Quick Emulator", QEMU is however a little challenging, relying on the command line rather than a mouse-driven interface. To save time, some guest operating systems can be downloaded with QEMU built in. See our look at running the Raspbian Pi OS in QEMU to get an introduction to this Linux VM 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 install qemu qemu-kvm libvirt-bin

As noted, the command line interface in the terminal is used to run QEMU. This can prove challenging for newer Linux users, but fortunately there are solutions. These QEMU forks add a graphical user interface (GUI) so you can run a Linux VM without typing commands:

These projects are in varying stages of development---for the best results, try QtEmu.

VMware are the industry leaders in desktop and server virtualization, with thousands of corporate clients. Fortunately, they also release a free version for more focused use cases.

Download: VMware Workstation Player

With support for all major Linux operating systems and over 200 guest OSes, VMware Workstation Player is a smart Linux VM solution. Note that unlike QEMU, however, VMware Workstation Player cannot run ARM operating systems.

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 and VMware

Conversely, QEMU is suitable for running ARM-targeted distributions, such as the Raspberry Pi OS, or Android.

Meanwhile, something lightweight like Lubuntu will run on any of these Linux virtual machine tools.

But what if you want to run all three? Fortunately, there is considerable cross-compatibility between them. You can import a VDI file from one VirtualBox installation to another, or you might convert a VMware VMDK into a readable IMG file for QEMU.

So whichever Linux VM app you use, you can be confident about moving your Linux VM to other devices.

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 straightforward and open source, then choose VirtualBox. If open source isn't a concern, then VMware might deliver a bit more stability, especially on newer computers.

Meanwhile if you want to run an ARM operating system on your Linux VM, choose QEMU. Use a GUI if you don't like spending too long in the terminal.