- .NET Core 2.0 By Example
- Rishabh Verma Neha Shrivastava
- 509字
- 2021-06-24 18:30:56
Ubuntu setup using Hyper-V
For Windows machines, we can use Hyper-V to create a Linux virtual machine. Let's start with the basic settings and important configuration changes:
- First, enable Hyper-V Management Tools and Hyper-V Platform from Windows Features:
- Change the default virtual directory. By default, Hyper-V uses the same drive as that on which the OS is installed but this is not a good practice. We should change the default drive the drive on which the operating system is not installed, such as the D drive in our case. It's a good practice to keep Windows and system files separate from other files. To make configuration changes, open Hyper-V Manager and then Hyper-V Settings. Instead of the default selection, change it to some other drive (D in our case). Create a new folder named Virtual Machine on this new drive location:
- Create a virtual switch. A virtual switch is used to join computers and to create networks. We can create three types for virtual switches:
- External: An accessible network where the virtual machines are hosted on the same physical computer and all external servers from which the host machine can connect.
- Internal: Creates a virtual switch that can be used only by the virtual machines that run on the same physical computer, and between virtual machines and the physical computer. An internal virtual switch doesn't provide connectivity to a physical network connection.
- Private: Creates a virtual switch that can be used only by the virtual machines that run on the same physical computer.
Create a Private or External type of virtual switch. This will be used for the virtual machine:
Open Network and Sharing Center on your host machine and then open the external virtual switch properties. You will find Hyper-V Extensible Virtual Switch. This provides network connectivity to the virtual machine. Enable this or the virtual machine won't be able to connect to the host machine network:
- Create a new virtual machine, and choose the name and location for the virtual machine. Select Generation 1 on the next page and select External Virtual Switch. Select the Install an operating system from a bootable CD/DVD-ROM option and select Image file (.iso), which we downloaded earlier for Ubuntu. Continue clicking the Next button in the wizard and the Ubuntu virtual machine will be created. Click on Start and connect to it:
- After connection, we will be able to see the following screen. Select Install Ubuntu and set the language as English. Choose the Erase disk and install Ubuntu option and then click Continue:
- Provide the username and password that you want and click Continue. Restart the system once the installation is done:
After restarting the virtual machine, it will display a login page. Enter the password that you provided while installing Ubuntu. On successful login, it will open the homepage, from where we can start Visual Studio Code and .NET Core 2.0 SDK installation on this Ubuntu machine.