Create a Linux OS on a Windows VM

When we use Windows computers for back-end development, We often need to use Linux system. In order to better cooperate with Linux system for development, the mainstream solution is to install virtual machine software on Windows system, such as VMware or Virtualbox virtualization software for virtualization.

But Windows 10 comes with a virtualization software called Hyper-V

Enable the Hyper-V function

To use Hyper-V, you need the CPU to support virtualization and Enable it. If CPU virtualization is not enabled on your motherboard, you need to set Intel Virtual Technology to Enable in the BIOS at startup.

After enabled, we can enter “Task Manager” to see whether virtualization is enabled, as shown below:

Enable Hyper-V with PowerShell

  1. Open the PowerShell console as an administrator.
  2. Run the following command:

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

If you cannot find this command, make sure you are running PowerShell as an administrator. After the installation is complete, restart the system.

Enable Hyper-V using CMD and DISM

The Deployment Image Services and Administration Tool (DISM) helps configure Windows and Windows images. Among many applications, DISM enables Windows functionality while the operating system is running. Enable Hyper-V roles with DISM:

  1. Open a PowerShell or CMD session as an administrator.
  2. Type the following command:

    PowerShell DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V

Enable the Hyper-V role by Setting

  1. Open Control Panel

  2. In Control Panel, select Programs

  3. Select “Enable or Disable Windows Features”

  4. Select Hyper-V and click OK.

When the installation is complete, you will be prompted to restart your computer.

Download the required base image

Here we take Ubuntu as an example: Chinese official website: cn.ubuntu.com/download

Enter the website to download Server version or the Desktop I’ll direct download Server version: download address: releases.ubuntu.com/bionic/ubun…

Create a VM using Hyper-V

Open the Hyper-V management tool

After entering hyper-V manager, you need to connect to the local server. Connect to the server:

Creating a Virtual Switch

Click “Virtual Switch Manager” on the right to pop up the virtual switch management window:

Create a new “Virtual Network switch” of type “External” and click “Create Virtual Switch”

After input switch name, select “external network” Beijing bind your physical network card, select a good, I this machine has many network cards, select the one you are using.

Make sure to save.

Create the ubuntu

Click “New “->” VIRTUAL Machine” on the right, and the virtual machine creation dialog box pops up:

Go straight to the next step:

Enter the name and storage location and proceed to the next step:

Select gen 1, if you need to install FreeNAS or UEFI boot system, select GEN 2, then proceed to the next step, enter the memory required by the VM:

The memory and CPU can be adjusted later.

Go to the next step and select the network

Here we select the virtual switch just created and proceed to the next step. If you do not select the virtual switch, you may not be able to connect to the Internet:

Go to the next step and select the location and size of the “Virtual hard disk” :

The hard disk can be adjusted later, but can only be increased.

In the next step, select the CD/DVD-ROM to install the operating system and select the downloaded operating system file to go to the next step.

Installing Ubuntu

After the VM is created, select the newly created VM and click Connect on the right. In the displayed window, click Start to start the VM. If no operation is performed on the page, click Start.

Then we will install the OPERATING system of Ubutnu

Step 1: Choose Chinese

Step 2: There’s nothing to say about installing Ubuntu, it’s basically just the next step

The tail

Hyper-v is pretty good, based on decent PC configuration, most importantly SSD.

Your reward is my motivation to renew