How to create a Linux virtual machine on Windows 10 using Hyper-V

Hyper-V
Hyper-V (Image credit: Windows Central)

Although it's now possible to run a number of Linux distros natively on Windows 10, these environments can be somewhat limited in features and tools you can use. Also, you can only pick from three distros, including Ubuntu, SUSE Linux Enterprise, and OpenSUSE Leap, and you're stuck with the command-line interface, which means that you can't run any of the graphical experiences (e.g., GNOME, KDE, XFCE) or Linux-based graphical applications.

Of course, you can always install your favorite Linux distro on a second machine, but if you don't have one, it's still possible to run a full-blown version of Linux using a virtual machine (VM).

If you're running Windows 10, you can enable Hyper-V on your device to create a VM to install your preferred distro whether you're a developer or an enthusiast who just wants to know what's the Linux fuzz all about.

In this Windows 10 guide, we'll walk you through the steps to install most Linux distributions on virtual machines using Microsoft's Hyper-V virtualization feature.

Guide requirements

To run a Linux virtual machine on Windows 10, you'll need the following:

  • A computer with support for Hyper-V.
  • An ISO file to install your preferred Linux distribution.

In this guide, we'll be using Ubuntu version 17.10, which you can download from the official Ubuntu website. However, it's possible to install version 16.04, which might be a more stable version of the open source project, and you can also install other distros, including:

  • CentOS and Red Hat Enterprise Linux.
  • Debian.
  • SUSE.
  • Oracle Linux.
  • FreeBSD.

How to enable Hyper-V on Windows 10

Hyper-V is a virtualization technology from Microsoft available on Windows 10 Pro, Enterprise, and Education, and it allows you to create one or multiple virtual machines to install and run different OSes on the same physical hardware.

Verifying Hyper-V support

Although Hyper-V is part of Windows 10, there is a minimum hardware requirement a computer must meet to enable the feature.

  • 64-bit CPU with Second Level Address Translation (SLAT).
  • Processor must support VM Monitor Mode Extension (VT-c on Intel chips).
  • 4GB of memory at a minimum.

In addition, you have to make sure the Virtualization Technology and Hardware Enforced Data Execution Prevention options are enabled on your system BIOS.

You can quickly verify your computer has the required support for Hyper-V using Systeminfo:

  1. Open Start.
  2. Search for Command Prompt and click the top result.
  3. Type the following command and press Enter:systeminfo.exe
  4. Under Hyper-V Requirements, if the result reads Yes, then you can run Hyper-V.

If the command displays No under Hyper-V Requirements, then your hardware doesn't support this feature, or you need to make sure to enable it manually.

Enabling Hyper-V

Use the following steps to enable Hyper-V on Windows 10:

  1. Open Control Panel.
  2. Click on Programs.
  3. Click on Turn Windows features on or off.

  1. Check the Hyper-V option making sure: Hyper-V Management Tools and Hyper-V Platform are also selected.
  2. Click OK to begin the process.

  1. After the installation completes, click Restart now to apply the changes.

How to create a virtual machine using Hyper-V

Once you've completed adding the virtualization layer to Windows 10, you'll need to create a virtual machine for the Linux distribution you want to use.

However, before you do that, you must create a virtual switch to allow the VM to connect to the internet.

Creating a virtual switch

Use the following steps to configure a virtual switch on Hyper-V:

  1. Open Start.
  2. Search for Hyper-V Manager and click the top result.
  3. Click on the Action menu.
  4. Select New and click on Virtual Switch Manager.

  1. On the left pane, select New virtual network switch.
  2. On the right, select External.
  3. Click the Create Virtual Switch button.

  1. Enter a new descriptive name for the switch (e.g., MyVirtualSwitch).
  2. Under connection type, make sure your network adapter is select on External network.
  3. Click Apply.
  4. Click OK.

Creating a virtual machine

After creating the virtual switch, you can proceed to create a new virtual machine:

  1. Open Start.
  2. Search for Hyper-V Manager and click the top result.
  3. Click on the Action menu.
  4. Select New and click on Virtual Machine.

  1. Click the Next button.
  2. Enter a descriptive name for your virtual machine (e.g., vm-ubuntu).

  1. Use the default location to store your virtual machine, or check the Store the virtual machine in a different location option to select a different path.
  2. Click Next to continue.
  3. You can leave the default Generation 1 option selected. Or you can select Generation 2 if you want a UEFI-based firmware.
  4. Click Next.

  1. Select the amount of RAM to allocate for your virtual machine. In the case of Ubuntu, you need a minimum of 2GB of memory.You can allocate as much memory as you want, but this setting will always depend on the physical memory available on your computer.
  2. Click Next.

  1. Use the drop-down menu to select the virtual switch you created earlier.
  2. Click Next.

  1. You can leave all the default settings to create a virtual hard drive, but under Size make sure to allocated at least 25GB of storage, which is the minimum required to run Ubuntu.
  2. Click Next to continue.

  1. On Installation options, select the Install an operating system from a bootable CD/DVD-ROM option.
  2. Select the Image file (.iso) option.
  3. Select the path for the ISO file with the Ubuntu installation files.
  4. Click Next.

  1. Click Finish.

How to install Ubuntu Linux using Hyper-V on Windows 10

The last step is to start the virtual machine and install the Linux distribution you want to use.

  1. On Hyper-V Manager, under Virtual Machine, right-click the newly created device, and select Connect.

  1. Click the Start (power) button.

  1. Select your language.
  2. Click the Install Ubuntu button.

  1. Check the Install third-party software for graphics and Wi-Fi hardware, Flash, MP3 and other media option.
  2. Click Continue.

  1. Select the Something else option.
  2. Click Continue.

  1. Double-click the /dev/sda drive.

  1. Click Continue.
  2. Double-click free space.

  1. Under "Use as," use the drop-down menu and select Swap area to create a swap partition.
  2. Under "Size," select the amount of space for the swap partition, which should be about 2x of the amount of RAM allocated for the virtual machine.
  3. Click OK.

  1. Double-click free space again.

  1. Select the amount of space to allocate for the installation.
  2. Under "Mount point," use the drop-down menu and select root /.
  3. Click OK.

  1. Select the ext4 partition from the list.
  2. Click the Install Now button.

  1. Click Continue to install Ubuntu.
  2. Select your time zone.
  3. Click Continue.

  1. Select the keyboard layout.
  2. Click Continue.

  1. Create a user account with your information.
  2. Click Continue.

  1. Restart the virtual machine to finish the setup.Quick Tip: If during the final restart process, you get a message to remove the installation and press Enter, but hitting the key won't restart the VM, just click the Turn off button and then turn it back on again.

After completing the steps, you can just turn on the VM and start using Ubuntu Linux alongside Windows 10.

While we're focusing this guide setting up Ubuntu, you can also refer to these instructions to run other distributions of Linux.

More Windows 10 resources

For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:

Mauro Huculak

Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he's a recognized member of the Microsoft MVP community.