Open Source For You

Using a Virtual Machine to Run Linux on Windows

If you would like to run Linux on Windows and have never used a virtual machine, this tutorial explains how you can do so in a few simple steps.

Linux and Windows are two of the most popular operating systems in the market. One can say that these two OSs have become essentials because of their continuous development and feature enhancements. Many people prefer one over the other. Yet, people who use Linux sometimes need the Windows operating system, and vice versa. For faster development and more security, people prefer to use Linux over Windows. So these people need Linux alongside Windows.

A common solution for this problem is to use a dual boot, which basically installs the entire operating system. However, due to boot loader changes (like UEFI mode), configuring dual boot becomes difficult.

This article is about running Linux on Windows, without using the dual boot technique. There are different ways to do so, one of the most popular being using a virtual machine.

Virtual machines

Virtualisation is fairly old technology now. It was started around 1980 by IBM. So, currently, this technology is pretty stable. We can create Linux virtual machines in Windows using software like Virtual Box, VMware Player, and VMware Workstation.

Figure 1: Virtual machine home

Figure 2: Creating a virtual machine

Figure 3: Assigning RAM

A virtual machine provides the same functionality as a physical computer, but it is an emulation of a physical computer. The virtual machine can be created or destroyed at any moment and it will not impact the actual operating system, which is the best part about using it.

To install Linux on Windows, we just require two things — the software to create a virtual machine which is Virtual Box (free software) and an ISO file of the operating system.

The installation process is pretty simple, like installing any software in Windows. The steps for installing Ubuntu (a favourite Linux flavour) inside Windows are given below.

The first step is to enable virtualisation technology in the BIOS. If you have already enabled it, you can skip this step.

You need to power on the system and go to the BIOS setup by pressing F2, Del or the Enter key, depending upon your computer model.

After that, under CPU Configuration -> System Configuration -> Advanced or Security Tab, we need to find Virtualization Technology or Intel Virtualization Technology. If the option is disabled, then it must be enabled. If it’s already enabled, skip this step.

If you get any of the following error messages at any point of time, it means that virtualisation technology is not enabled for you and you need to enable it:

If you have not installed Virtual Box, then you can go to the links https://www.virtualbox.org/wiki/Downloads and http://download.virtualbox.org/virtualbox/5.1.28/VirtualBox-5.1.28-117968-Win.exe, and download and install it. The steps are very straightforward; hence, I am not mentioning them here.

Figure 4: Select virtual hard disk

Figure 5: Select virtual hard disk type

Figure 6: Disk space

Open the Virtual Box application once it is installed. It will look like what’s shown in the snapshot in Figure 1.

Click on the New button and select the OS category before providing the appropriate name to the virtual machine.

Assign RAM as per your requirements. Ubuntu can run on 512MB, which is the minimum requirement to run Linux smoothly on Windows. Since I have 8GB RAM in my laptop, I have chosen 2048MB (2GB) RAM.

The next option is to select the virtual hard disk. Since we are creating a new virtual machine, we will use the ‘Create virtual hard disk now’ option.

Here we need to select the virtual hard disk type. Since we are using Virtual Box, we will use VDI which is a Virtual Box disk image.

There are two options here — we can either use a fixed size or a dynamic size. It is better to opt for the latter so that the size can be increased if required.

Allocate the disk space as per your requirement.

Once it is done, go to the virtual machine that you have created, right-click on it and go to the settings of that machine. Now we must attach the ISO file so that while we run the VM, it should know the location of the Ubuntu ISO file. As shown in the snapshot (Figure 7), click on the DISK button and browse the .ISO file of Ubuntu OS. The ISO file is now attached.

Figure 7: Selecting the ISO file

Figure 8: Installation started

Figure 9: Install Ubuntu like any normal OS

Next, go to the virtual machine, right-click on it and start it.

You will get the Ubuntu installation screen, which is similar to installing any operating system that you have chosen. The remaining steps are similar to the installation of any OS.

If you want to close the virtual machine window, you can do one of three things.

1. Save the machine: This is like hibernate. The system will resume from wherever you left off, the next time when you start — it will show you the same task at which you paused.

2. Send the ‘Shutdown’ signal: This is like pressing the power button. It will allow normal shutdown of the virtual machine.

3. Power off the machine: This is like pulling a power cable. It is for a hard shutdown which is required in scenarios where a VM gets hung or is not working properly.

At any time, if you want to destroy the virtual machine you created, right-click and select the Remove option. This will remove all the related files.

In this article, we have seen the basic operations of a virtual machine. We can explore other options in a subsequent one.