How to set up Ubuntu on Hyper-V

Hyper-V is a native type 1 hypervisor developed by Microsoft for the Windows family of operating systems, similar to Xen or VMWare ESXi. It was first released for Windows Server in 2008, and has been available without additional charge since Windows Server 2012 and Windows 8.

Hyper-V allows Ubuntu to be run in parallel or in isolation on Windows operating systems. There are several use-cases for running Ubuntu on Hyper-V:

  • To introduce Ubuntu in a Windows-centric IT environment.
  • To have access to a complete Ubuntu desktop environment without dual-booting a PC.
  • To use Linux software on Ubuntu that is not yet supported on the Windows Subsystem for Linux.

Hyper-V system requirements

The following are typical system requirements for Hyper-V:

  • A 64-bit processor with Second Level Address Translation (SLAT)
  • CPU support for virtualization extensions and virtualization enabled in the system BIOS/EFI
  • Minimum of 4 GB of memory, recommended 8 GB
  • Minimum of 5 GB of disk space, recommended 15 GB

Install Hyper-V

Our first step in enabling Ubuntu is to install Hyper-V, which can be used on the Windows 11 Pro, Enterprise, Education and Server operating systems.

Hyper-V is not included in Windows 11 Home, which would need to be upgraded to Windows 11 Pro.

Install Hyper-V graphically

  1. Right click on the Windows Start button and select ‘Apps and Features’.

  2. Select ‘Programs and Features’ under Related Settings.

  3. Select ‘Turn Windows Features on or off’.

  4. Select ‘Hyper-V’ and click OK.

  5. Restart when prompted.

Install Hyper-V using PowerShell

  1. Open a PowerShell console as Administrator.

  2. Run the following command:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
    
  3. Restart when prompted.

Install Ubuntu on Hyper-V

There are two main methods for installing Ubuntu on Hyper-V depending on your use case. Read each of the descriptions of the following methods and then determine the best for your situation.

Using Quick Create

The recommended method is to use the curated Ubuntu image from the Hyper-V Quick Create Gallery. This is ideal for desktop development on Ubuntu and for users interested in running a complete Ubuntu desktop environment. The Ubuntu image from the Quick Create Gallery includes pre-configured features, such as clipboard sharing, dynamic resolution display, and shared folders.

  1. Enable Hyper-V as described above.

  2. Open ‘Hyper-V Manager’ by either:

    • Selecting the Windows Start button, then
      → Expanding the ‘Windows Administrative Tools’ folder
      → Selecting ‘Hyper-V Manager’

    or

    • Selecting the Windows key, then
      → typing ‘Hyper-V’
      → selecting ‘Hyper-V Manager’

    In the future, the Quick Create tool can be accessed directly using the above methods, but it is useful to know where Hyper-V Manager is because it is what you will use to manage your Ubuntu VM.

  3. On the ‘Actions’ pane select ‘Quick Create’ and the Quick Create tool will open.

  4. Select a version of Ubuntu from the versions on the list. A build of the most recent LTS version of Ubuntu and the most recent interim release are provided.

    • The LTS version is recommended if you are developing for Ubuntu Server or an enterprise environment.
    • The interim release is recommended if you would like to use the latest versions of software in Ubuntu.
  5. Select ‘Create Virtual Machine’ and wait for the VM image to be downloaded.

  6. Select ‘Connect’ to open a connection to your VM.

  7. Select ‘Start’ to run your VM.

  8. Complete the final stages of the Ubuntu install, including username selection.

Using an Ubuntu CD image

It is possible to install Ubuntu on Hyper-V using a CD image ISO. This is useful if you are running Ubuntu Server and do not need an enhanced desktop experience. Note that the enhanced features of the Quick Create images are not enabled by default when you perform a manual install from an ISO.

  1. Download an Ubuntu ISO from an official Ubuntu source.

  2. Install Hyper-V as described above.

  3. Open ‘Hyper-V Manager’ by either:

    • Selecting the Windows Start button, then
      → Expanding the ‘Windows Administrative Tools’ folder
      → Selecting ‘Hyper-V Manager’

      or

    • Selecting the Windows key, then
      → Typing ‘Hyper-V’
      → Selecting ‘Hyper-V Manager’

  4. On the ‘Actions’ pane click ‘Quick Create’ and the Quick Create tool will open.

  5. Select ‘Change installation source’ and choose the ISO file you downloaded before.

    If you want to give your virtual machine a more descriptive name, select the ‘More options’ down-arrow and change ‘New Virtual Machine’ to something more useful, e.g. ‘Ubuntu Server 18.04 LTS’.

  6. Select ‘Create Virtual Machine’ and wait for the virtual machine to be created.

  7. Select ‘Connect’ to open a connection to your VM.

  8. Select ‘File’ in the menu bar, then
    → Choose ‘Settings’ and select the ‘Security’ tab
    → Under Secure Boot choose ‘Microsoft UEFI Certificate Authority’
    → Then select ‘Apply’ and ‘OK’ to return to your VM.

  9. Select ‘Start’ to run your VM.

  10. Complete the manual installation of Ubuntu.