Hyper-V Linux server installation

Official documentation: Create a virtual machine with Hyper-V on Windows 10 Creators Update | Microsoft Learn

1 Add a new virtual switch

Open the Hyper-V Manager, find the operation column on the right, and click "Virtual Switch Manager":

Click "New Virtual Network Switch", select "External" as the switch type, and click to create a virtual switch:

Set the properties of the switch, such as name and description. Select external network as the connection type. The default is usually the first one in the drop-down list. Check "Allow the management operating system to share this network adapter":

After clicking OK, the following pop-up window will appear, indicating that pending changes may interrupt the network connection and may disconnect the network for a while. If the network disconnection does not have much impact, just click Yes. Otherwise, please do it first. Prepare accordingly.

2 Create a virtual machine

In the operation window, click "New" --> "Virtual Machine"

  • Specify name and location

  • Specify algebra

  • Allocate virtual machine memory

  • Configure the network (you can select the switch configured in the new virtual switch)

  • Connect virtual hard disk

  • Installation options: What I choose here is to install the image file I downloaded locally.

  • Summary

After browsing the information in the summary and confirming that it is correct, click "Finish" to install the Linux virtual machine image. The next step is to install the Linux system.

After the installation is complete, the following menu will appear

Reference link: Win10 system comes with virtual machine Hyper-V, install Linux instead of VMware - Zhihu

3 settings

Select the virtual machine and click "Settings" in the lower right corner, or right-click the virtual machine and click "Settings":

  • Turn off secure boot

Under the Security menu, check "Enable Secure Boot"

  • Turn on checkpoint function

After setting a checkpoint, the virtual machine can later be restored to the state when the checkpoint was set.

4 Install the operating system

Enter the virtual machine and you will see the following page

Click "enter" to install, and the following page will pop up to select the system language:

Click to enter the installation location page:

Select the disk, select the virtual disk created previously, and click Finish

Click "Start Installation":

Click to enter the ROOT password setting page:

Set the ROOT password and click "Finish" after setting to return to the configuration page.

On the configuration page, click "Complete Configuration" and wait for configuration.

After the configuration is complete, click "Restart"

After waiting for a while, you will be prompted to enter your login username and password:

Enter and press Enter. The following indicates successful login:

5 Network settings

vi /etc/sysconfig/network-scripts/ifcfg-eth0
# 将ONBOOT=no改为yes --开机自动调用

On the host machine, open the network and click "Change Adapter Settings". At this time, you can see that the virtual switch we configured has no network:

Select the network you are using, right-click and click "Properties", select the "Sharing" tab, select the initially configured virtual switch, and click OK.

At this time, the virtual switch already has a network:

You can also ping Baidu from the server.

Reference link: Installing the Linux system on the Hyper-V virtual machine that comes with Win10_win10 hyper-v linux_Maple_Lin's Blog-CSDN Blog

6 Connect using ssh

Use ifconfig to check the server IP and find that the command cannot be found, then install it:

# 查看安装ifconfig需要安装什么包
yum search ifconfig  

# 安装ifconfig
yum install net-tools.x86_64

After the installation is complete, you can see the IP address of the server and use this address directly for ssh connection. However, the current setting is to obtain IP dynamically, and the IP address will not be fixed. If you want to use a certain IP for connection, you can set a static IP address.

Guess you like

Origin blog.csdn.net/weixin_46505978/article/details/132401372