Windows 2019
Sponsored Link

Hyper-V : Create Virtual Machine (Linux)2019/04/10

 
On this example, Create a Virtual Machine with installing CentOS Linux.
On CUI configuration, set like follows.
[1] Run PowerShell with Admin Privilege and configure.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# confirm network adapter names
PS C:\Users\Administrator> Get-NetAdapter 

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Ethernet0                 Intel(R) 82574L Gigabit Network Conn...       6 Up           00-0C-29-C7-54-1A         1 Gbps

# create a virtul switch
PS C:\Users\Administrator> New-VMSwitch -Name "Bridge01" -AllowManagementOS $True -NetAdapterName "Ethernet0" 

# confirm
PS C:\Users\Administrator> Get-VMSwitch 

Name     SwitchType NetAdapterInterfaceDescription
----     ---------- ------------------------------
Bridge01 External   Intel(R) 82574L Gigabit Network Connection

# create a directory for virtual machines
PS C:\Users\Administrator> mkdir E:\Virtual_Machine 

# set VM name and others
PS C:\Users\Administrator> $ParentDir = 'E:\Virtual_Machine' 
PS C:\Users\Administrator> $VMName = 'CentOS8' 
PS C:\Users\Administrator> $Switch = 'Bridge01' 

# create a virtual machine
PS C:\Users\Administrator> New-VM -Name $VMName `
-MemoryStartupBytes 4GB `
-Generation 1 `
-NewVHDPath "$ParentDir\$VMName\$VMName.vhdx" `
-NewVHDSizeBytes 20GB `
-Path "$ParentDir\$VMName" `
-SwitchName $Switch 

Name    State CPUUsage(%) MemoryAssigned(M) Uptime   Status             Version
----    ----- ----------- ----------------- ------   ------             -------
CentOS8 Off   0           0                 00:00:00 Operating normally 9.0

# change vCPU count
PS C:\Users\Administrator> Set-VMProcessor $VMName -Count 2 

# confirm virtual DVD drive
PS C:\Users\Administrator> Get-VMDvdDrive -VMName $VMName 

VMName  ControllerType ControllerNumber ControllerLocation DvdMediaType Path
------  -------------- ---------------- ------------------ ------------ ----
CentOS8 IDE            1                0                  None

# set install image to virtual DVD drive
PS C:\Users\Administrator> Set-VMDvdDrive -VMName $VMName `
-Path 'C:\Users\Administrator\Documents\CentOS-8.2.2004-x86_64-dvd1.iso' 

PS C:\Users\Administrator> Get-VMDvdDrive -VMName $VMName 

VMName  ControllerType ControllerNumber ControllerLocation DvdMediaType Path
------  -------------- ---------------- ------------------ ------------ ----
CentOS8 IDE            1                0                  ISO          C:\Users\Administrator\Documents\CentOS-8.2.2004-x86...

# start the virtual machine
PS C:\Users\Administrator> Start-VM -Name $VMName 

# after this, refer to [13] to install OS
Hyper-V : Create Virtual Machine (Linux) (GUI)
 
On GUI configuration, set like follows.
[2] Run [Server Manager] and Open [Tools] - [Hyper-V Manager].
[3] Select Hostname on the left pane and right-click it to open the menu, and then select [New] - [Virtual Machine].
[4] Click [Next] button.
[5] Input name of Virtual Machine. Any name is OK.
[6] Specify generation of Virtual Machine. On this example, select [Generation 1].
[7] Assign Memory for Virtual Machine.
[8] Select Virtual Switch to use networking of Virtual Machine.
[9] Configure Virtual Hard Disk. Set parameters you like.
[10] Select installation source of GuestOS.
[11] Click [Finish] button if that's OK.
[12] Virtual machine has been just created. To start it, right-click it and select [Start].
[13] To connect the console of Virtual Machine, right-click it and select [Connect].
[14] Install GuestOS with common procedure.
[15] Installation has finished and Virtual Machine CentOS Linux is running now.
Matched Content