Home / Articles / Web Tools / How to Install a Linux Virtual Machine on Windows

How to Install a Linux Virtual Machine on Windows

Are you interested in running Linux applications on your Windows computer without having to dual boot or purchase a separate machine? Installing a Linux Virtual Machine (VM) on your Windows operating system is a simple solution. Best of all, you won't need to change your current system significantly. 

Due to the nature of my work, I often need to run various versions of applications. For example, when testing Virtual Private Networks (VPNs). It's impractical for me to buy a separate machine for each platform, and that's when VMs come in handy.

Thanks to tools like VMWare Player and Virtualbox, setting up a VM today is relatively simple. Here I'll run through a guide based on Virtualbox and take you through the steps.

1. Download and Install VirtualBox

The VirtualBox interface is clean and easily navigable.

VirtualBox is a free and open-source virtualization software from Oracle that enables you to run multiple operating systems on a single computer. Go to the VirtualBox download page and download the latest version for Windows. 

Once the download is complete, run the installation file and follow the on-screen instructions to install VirtualBox on your computer.

2. Download a Linux Distribution

Once you have installed VirtualBox, you must download a Linux distribution. Part of the beauty of Linux is that so many variants exist. While there are some popular distributions, such as Ubuntu and Debian, you can technically choose from hundreds of others.

When downloading your Linux distribution, try downloading it from the official website as much as possible. If you aren't sure what to get – Ubuntu Desktop, CentOS, Debian are some good Linux builds for beginners.

Remember that you must download the Linux distribution as an ISO file. That will let you mount it as a virtual CD on your VM.

3. Create a New Virtual Machine

Setting up a Linux VM in VirtualBox takes just a few clicks.

Launch VirtualBox and click the “Machine” option on the top navigation bar. From the dropdown menu, select “New” to create a new virtual machine. Enter a name for the virtual machine, then select the ISO image you downloaded earlier.

Do not click “Finish” until you've allocated system resources to your VM.

Next, click “Hardware” (see image above) and allocate resources for your Linux VM. The most basic Linux VM can run with surprisingly little memory, but I recommend no less than 2GB. Anything less, and you may encounter problems with some apps later on the VM.

Next, click “Hard Disk” and allocate space for your Linux Virtual Machine. VirtualBox reserves this from your existing physical disk space, so ensure you have enough space on your drive. The default size is 25GB, but I give it more slack since I have lots of space on my drive.

You can now click “Finish.”

4. Install Linux & Guest Addons

VirtualBox will create the VM and install your chosen flavor of Linux. You'll need to provide details as you normally would during a fresh Linux installation—for example, your admin username and password.

Once the Linux installation completes, I highly recommend installing the VirtualBox Guest Additions. This module provides additional functionality, such as seamless mouse integration, improved video support, and shared folders. 

To install Guest Additions, go to the “Devices” menu in the virtual machine window and select “Insert Guest Additions CD image.” Then, follow the on-screen instructions to install the Guest Additions.

Once you have completed these steps, you will have a fully functional Linux virtual machine running on your Windows computer, and you can use it to run Linux applications and perform various tasks.

Quick Recap

Time needed: 40 minutes

Setting up a VM today is relatively simple with the right tool. In this guide, we will take you through the steps in setting up a virtual machine on your Windows computer using Virtualbox.

  1. Download and Install VirtualBox

    Go to the VirtualBox download page and download the latest version for Windows. 
    Once the download is complete, run the installation file and follow the on-screen instructions to install VirtualBox on your computer.

  2. Download a Linux Distribution

    Once you have installed VirtualBox, you must download a Linux distribution. If you aren't sure what to get – Ubuntu Desktop, CentOS, Debian are some good Linux builds for beginners.

  3. Create a New Virtual Machine

    Launch VirtualBox and click the “Machine” option on the top navigation bar. From the dropdown menu, select “New” to create a new virtual machine. Enter a name for the virtual machine, then select the ISO image you downloaded earlier.

  4. Install Linux & Guest Addons

    For a fresh Linux installation, you'll need to provide details as you normally would – for example, your admin username and password. Once the Linux installation completes, I highly recommend installing the VirtualBox Guest Additions. To install Guest Additions, go to the “Devices” menu in the virtual machine window and select “Insert Guest Additions CD image.” Then, follow the on-screen instructions to install the Guest Additions.

Common Problems with Linux VM on VirtualBox

Most of the time, running a Linux VM with Virtualbox is relatively simple and trouble-free. However, some odd issues may crop up occasionally, especially if you're trying to access the VM remotely or over your network.

Here are some of the problems I've encountered and possible resolutions;

Black Screen When Starting the VM

You can sometimes experience a black screen if your virtual machine is misconfigured or the display settings are incorrect. Check the display settings of the virtual machine, such as the screen resolution and graphics controller, and adjust them as needed. You can also try disabling 3D acceleration or switching to a different graphics controller.

No Internet Connection on the VM

Network issues can occur for many reasons. The most typical is a misconfiguration of the virtualized network card or your Linux network settings. When configuring the virtualized network card, try setting it to “bridged mode.” For Linux network settings, use “Auto” for your configuration unless you know what you're doing.

Slow Performance or Laggy Experience

Having a laggy VM is no fun, and that's what tends to happen when you don't allocate sufficient resources. YOu can fix this by going into the VM settings on VirtualBox and bumping up the RAM allocation. If you can spare the cores, having 2 CPU cores will also provide a much smoother experience.

Advantages of Running a Linux Virtual Machine on Windows

Building your own Linux virtual machine offers many benefits. Depending on your situation or needs, some or all of the following might apply:

  • Compatibility: Running a Linux virtual machine can provide compatibility if you need to run Linux-specific applications or tools unavailable on Windows.
  • Learning: A virtual machine can be a great way to experiment with different distributions and configurations if you want to learn Linux without installing it on a physical machine.
  • Infosec Development: If you are a security engineer, you may need to use Linux. Running a virtual machine can provide an isolated development environment to reduce the risk of malware or viruses infecting the host system.
  • Convenience: Running a dual boot system can be inconvenient since you can only use one at a time. A virtual machine is a good compromise, provided you have sufficient system resources to handle them.

Disadvantages of Running a Linux Virtual Machine on Windows

Although it's worked out well for me, running a Linux virtual machine may not suit everyone's needs. My primary motivation for running a Linux VM was simply to meet work objectives. Local-run virtual machines created on VirtualBox are free and relatively simple to use. 

However, they also present some downsides:

  • Complexity: Setting up and managing a virtual machine can be more complex than running Linux natively on the host system.
  • Resources: Unless you're running the virtual machine on a spare system, you may find your machine lagging due to the increased demand for system resources.

If you're considering using a virtual machine as a testbed for web apps or websites, you may want to know that things here get more complex. You must also install many things from scratch since the default environment differs widely from a ready-made VPS, even if it's just a shell. Instead, consider one of the many cheap Cloud VPS plans available.

Alternative for Easier Setup: Cloud / VPS Hosting

Many Cloud VPS hosts are available at various prices. Choosing an unmanaged hosting plan for those seeking a development environment can help you save on costs. Here are some of the cheaper (but still good) options you can try;

1. Digital Ocean

Website: https://www.digitalocean.com

One of my personal favorites, Digital Ocean is affordable, even if it isn't the cheapest around. For as little as $4/mo, you can quickly spin up almost any Linux distro you want. The plans scale easily on demand and are highly configurable.

2. VULTR

Website: https://www.vultr.com

If you're looking for the lowest possible Cloud prices, VULTR is a top choice. With a starting price of only $2.50/mo, you'll hardly know you're paying for the service. You can customize plans with add-ons like storage, database, and more.

3. TMD Hosting VPS

Website: https://www.tmdhosting.com

TMD is a more noticeable name in web hosting because they offer a full range of service. Their Cloud VPS is slightly more expensive, starting at $5.95/mo. However, it's a good deal for those wanting slightly more power in their hosting plan.

Why Choose a Cloud VPS instead of a Linux Virtual Machine?

Cheap cloud VPS hosting can be better than a Linux virtual machine on a local device in several ways:

  • Reliability: Cloud VPS hosting typically comes with built-in redundancy and failover options, which can provide better reliability and uptime than running a virtual machine on a local device. In addition, cloud providers often have backup and disaster recovery options that can help to protect data in the event of a failure.\
  • Accessibility: Cloud VPS hosting can be accessed from anywhere with an internet connection, making it a more accessible option for users working remotely or from multiple locations. In contrast, a Linux virtual machine on a local device may be limited to a single location.
  • Maintenance: Cloud VPS hosting providers handle the underlying hardware and software maintenance and updates. This provision can be a better deal for those who lack the time and expertise to handle virtual machines.
  • Cost: In some cases, cloud VPS hosting can be more cost-effective than running a virtual machine on a local device, particularly if you need to scale resources or require redundancy and failover options. In addition, you don't need to invest in hardware or pay for the ongoing maintenance and electricity costs of running a virtual machine on a local device.

Final Thoughts – Linux Virtual Machine or Cloud VPS?

Both Linux virtual machines and cloud VPS (Virtual Private Server) have advantages and disadvantages, and the choice will depend on your specific needs and requirements.

If all you need is a local development and testing code box, then a Linux virtual machine is a quick and easy resolution. However, I suggest you check out a cloud VPS plan for anything beyond that.

Also Read

Photo of author

Article by Jerry Low

Keep Reading