First things first, you need to be either running Windows 10 Pro (Win 7 Pro+ or 8.1 Pro works too but you should upgrade..), Windows Server 2012 R2+, or Hyper-V Server. To get the version of Windows you are running you can open a PowerShell prompt and run:
# PowerShell [Hyper-V Host] systeminfo | findstr /B /C:"OS Name"
It should return something like this:
After you confirm you are on the correct version of Windows, you can enable Hyper-V. To do this run the following in an elevated PowerShell console:
# PowerShell [Hyper-V Host] Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
After the installation is successful you will need to reboot your machine. If it errors out and says something like: “Hyper-V cannot be installed: The processor does not have the required virtualization capabilities.”
You will need to, first, double check that your processor supports virtualization, and second, make sure its enabled in your motherboards UEFI/BIOS. However, since every system is different I will have to refer you to your motherboard’s documentation and https://ark.intel.com / https://amd.com to do that.
The installation process of Hyper-V requires a machine reboot. After you reboot launch the Hyper-V Manager.
I recommend that you edit your Hyper-V storage locations so that its not defaulting to
C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks and
C:\ProgramData\Microsoft\Windows\Hyper-V. This can be done via the Hyper-V Settings menu after right clicking your PC in the left pane.
Configuring the Virtual Machine
Right click your host again and select Virtual Switch Manager.
- In the left pane select “New virtual network switch”.
- “External” in the right pane.
- Click “Create Virtual Switch”.
- Name your network adapter.
- In the Connection type drop down select your network adapter.
- Click Apply.
After doing the above, right click your host again and select New > Virtual Machine. When the New Virtual Machine Wizard window opens, select Next.
- Name: <Name of virtual machine to be used to identify it.>
- Generation 2 (Adds more features and supports UEFI for the VM)
- Startup memory field: <at least 2GB+>
- Uncheck Dynamic Memory
- Connection: <select your vNet switch adapter>
- Create a virtual hard disk: <Checked>
- Name: <leave default to use machine name from step 1>
- Size field: <at least 10GB+>
- Install an operating system from a bootable image file: <Checked>
- Click Browse and find your Ubuntu Server .iso file.
- Verify settings
Before powering on your new VM, you’ll need to edit the CPU core allocation. Since, for some reason, Microsoft doesn’t include this in the GUI setup wizard. To do this, you’ll need to right click your VM in the Virtual Machines section and click settings. When the settings window shows up do the following:
- Click Processor and edit the “Number of virtual processors” field (I recommend at least 2 cores).
- Select Security and under Template click
Microsoft UEFI Certificate Authority
- Select Integration Services and make sure everything is checked.
- Click Apply and close the settings window.
Starting the Virtual Machine
Now that our VM is ready we can go ahead and start it. To do this, right click your VM and select “Connect”. This will launch a console window where you can view the VM (think monitor). Click the “Start” button in the console window. The Ubuntu installer should automatically start.