How to Create a Linux VM for Lab Work Using Hyper-V [Built into your Windows 10 – 11 device]

Overview

This guide walks through creating a Linux virtual machine for lab work using the built-in Hyper-V feature on Windows. The goal is to avoid third-party virtualization tools like VirtualBox or VMware and use what is already available in Windows Pro, Enterprise, or Education editions.

This type of VM is useful for SOC learning, Linux practice, log analysis, scripting, networking labs, and building a small home lab environment.

Requirements

  • Windows 10 or Windows 11 Pro, Enterprise, or Education
  • Virtualization enabled in BIOS or UEFI
  • Hyper-V enabled
  • A Linux ISO such as Ubuntu Server, Ubuntu Desktop, Debian, or Kali
  • At least 4 GB RAM available for the VM
  • At least 30 GB free disk space

Step 1: Enable Hyper-V Using the GUI

To enable Hyper-V using the graphical interface:

  1. Open the Start Menu.
  2. Search for Turn Windows features on or off.
  3. Enable Hyper-V.
  4. Make sure both Hyper-V Management Tools and Hyper-V Platform are selected.
  5. Click OK.
  6. Restart the computer when prompted.

Step 2: Enable Hyper-V Using PowerShell

You can also enable Hyper-V from an elevated PowerShell window:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

After the command completes, restart the computer.

Step 3: Download a Linux ISO

Download the Linux distribution you want to use for the lab. Good beginner options include:

  • Ubuntu Desktop
  • Ubuntu Server
  • Debian
  • Kali Linux

For general lab work, Ubuntu Server or Ubuntu Desktop is a good starting point. Kali is useful for security testing labs, but it should be used carefully and only in authorized environments.

Step 4: Create the VM Using Hyper-V Manager

To create the VM using the GUI:

  1. Open Hyper-V Manager.
  2. Select your local machine.
  3. Click New and then Virtual Machine.
  4. Name the VM something clear, such as Ubuntu-Lab.
  5. Select Generation 2.
  6. Assign memory, such as 4096 MB.
  7. Select a network switch. The Default Switch is fine for basic internet access.
  8. Create a virtual hard disk, for example 40 GB.
  9. Choose Install an operating system from a bootable image file.
  10. Select the Linux ISO.
  11. Finish the wizard and start the VM.

Step 5: Create the VM Using PowerShell

You can also create the VM using PowerShell. Update the ISO path before running the commands.

$VMName = "Ubuntu-Lab"
$VMPath = "C:\Hyper-V\$VMName"
$ISOPath = "C:\ISO\ubuntu.iso"
$VHDPath = "$VMPath\$VMName.vhdx"

New-Item -ItemType Directory -Path $VMPath -Force

New-VM `
  -Name $VMName `
  -Generation 2 `
  -MemoryStartupBytes 4GB `
  -NewVHDPath $VHDPath `
  -NewVHDSizeBytes 40GB `
  -Path $VMPath `
  -SwitchName "Default Switch"

Set-VMProcessor -VMName $VMName -Count 2
Set-VMMemory -VMName $VMName -DynamicMemoryEnabled $true -MinimumBytes 2GB -StartupBytes 4GB -MaximumBytes 6GB

Add-VMDvdDrive -VMName $VMName -Path $ISOPath
Set-VMFirmware -VMName $VMName -FirstBootDevice (Get-VMDvdDrive -VMName $VMName)

Set-VMFirmware -VMName $VMName -EnableSecureBoot Off

Start-VM -Name $VMName

Disabling Secure Boot is often useful for Linux lab VMs, especially when using distributions that do not boot cleanly with Hyper-V Secure Boot enabled.

Step 6: Configure Networking

For a simple lab, the Default Switch is usually enough. It provides basic internet access through NAT.

For more advanced lab work, you can create separate switches:

  • Default Switch: Simple internet access
  • External Switch: VM connects to the same network as the host
  • Internal Switch: Host and VMs communicate, but the VM is not directly exposed externally
  • Private Switch: VMs communicate only with each other

For SOC and malware-analysis-style labs, isolated networks are safer. For normal Linux learning, updates, and package installs, the Default Switch is fine.

Step 7: Install Linux

Start the VM and connect to it from Hyper-V Manager. Follow the Linux installer prompts.

Recommended basic settings:

  • Create a normal user account.
  • Use a strong password.
  • Enable OpenSSH only if you need remote access.
  • Apply updates after installation.
  • Install Hyper-V integration packages if needed, though many modern Linux distributions support Hyper-V well by default.

Step 8: Take a Checkpoint

After the VM is installed and updated, take a checkpoint. This gives you a clean rollback point before making lab changes.

Using the GUI:

  1. Right-click the VM in Hyper-V Manager.
  2. Select Checkpoint.
  3. Name it something like Clean Install.

Using PowerShell:

Checkpoint-VM -Name "Ubuntu-Lab" -SnapshotName "Clean Install"

Step 9: Lab Security Tips

  • Do not expose lab VMs directly to the internet unless you understand the risk.
  • Keep the VM updated.
  • Use snapshots before testing major changes.
  • Separate normal lab VMs from risky testing environments.
  • Document the VM purpose, IP address, credentials location, and installed tools.

Step 10: Troubleshooting

Hyper-V is not available

Check that you are using Windows Pro, Enterprise, or Education. Hyper-V is not normally available on Windows Home.

The VM does not boot from ISO

Check the DVD drive is attached and set as the first boot device. If using Linux, try disabling Secure Boot.

The VM has no internet

Confirm the VM is connected to the Default Switch or another correctly configured virtual switch.

The VM is slow

Increase RAM, assign more CPU cores, or close other heavy applications on the host.

Final Thoughts

Hyper-V is a solid option for building a local lab without installing extra virtualization software. For someone moving from IT support and infrastructure support into SOC analysis, it is a practical way to build Linux skills, test configurations, generate logs, and document repeatable lab work.

This becomes the foundation for later projects such as Sysmon logging, SIEM forwarding, phishing analysis labs, and basic detection engineering practice.