Install Centos7 using Hyper-v virtual machine

Install Centos7 using Hyper-v virtual machine

introduce

It allows you to run multiple operating systems on your computer as virtual machines (as for why I chose this, it's mainly because the system already comes with it, so if I can avoid installing anything else, I'll try it out first)

Hyper-V is available for 64-bit Windows 10 Professional, Enterprise, and Education editions. It is not available for Home Edition.

Prepare

Download system image

Go to Alibaba Cloud to download the system: http://mirrors.aliyun.com/centos/7/isos/x86_64/

It is recommended to download this version, which has a minimum installation size of 900M. The DVD version is larger, but will have a lot of stuff in it.

Enable Hyper-V

Search for Control Panel in the lower left corner of your computer

Select Programs and click Turn Windows features on or off

After checking the application and waiting for the end, restart the system

After the restart is complete, you can search for Hyper-V Manager on the computer

The following steps are completed using this tool.

Create a new virtual network switch

Open Hyper-V Manager

Then specify the name of this interface, and select the external network in the reference network connection

Create a new virtual machine

Right click to create a new virtual machine

Change a meaningful name and set the storage location of the virtual machine (make sure there is enough space)

Select the generation of the virtual machine and go to the next step

Allocate memory size()

Set it according to your personal situation. If the things you want to run in your virtual machine are large, you need to configure a larger one.

Configure the network, select the one we configured from the drop-down list, and then click Next

Connecting a Virtual Hard Drive

Installation options Choose the mirror location

Confirm our installation information again and click Finish

View the created virtual machine

Select and click Start on the right, then click Connect after it starts.

Installing the system

Start the virtual machine, then after connecting, use the keyboard to select Install CentOS7, and then enter

Enter the installation interface and select the installation language

Configuring installation location and network

Click the installation location

Configure network and hostname

Then click Install

Set the root password. Here you can set a simple or complex password according to your personal situation.

No additional users will be created here, just use root

Restart after successful installation

Click enter to enter the system, enter the username root, and the password is the password we just set

Enter the ls command to view

Try pinging Baidu to see if you can access the external network

ping baidu.com

operate

View network configuration information

ip addr

The IP address at this time is a dynamically assigned IP address

If you are not used to the default interface, you can use a third-party terminal tool (MovaXterm, shell) to connect.

MovaXterm Basic Use

It is recommended to use MovaXterm, download address: https://mobaxterm.mobatek.net/. If necessary, you can find the Chinese version online.

The following is a brief description of how to use it. Open the MovaXterm tool and create a new session.

Select the session type (multiple types are supported), here we choose SSH

Click OK, then enter your password to connect.

The software demonstrated above is what I use for learning

Setting a Static IP

Enter the specified directory to modify the configuration, which contains the network configuration

cd /etc/sysconfig/network-scripts 
ls

Edit the ifcfg-eth0 file using vm

vi ifcfg-eth0

Edit the file to add or modify the following configuration

Basic usage of vi: press i to enter edit mode, save and exit by pressing esc, then enter: wq

BOOTPROTO="static" #Set static ip
ONBOOT="yes" #Set the system to start automatically IPADDR=192.168.1.8 #Assign IP. The first three segments should be consistent with the local machine, and the last segment should be different NETMASK=255.255.255.0 #Consistent with the local machine GATEWAY=192.168.1.1 #Consistent with the local machine DNS1=192.168.1.1 #Consistent with the gateway. If you don't add it, you can't access the Internet

Query the local computer's IP and subnet mask through cmd

ipconfig

After modification, as shown in the figure

Restart the network service to make the above configuration take effect

I use the built-in interface of hyper-v to run this.

service network restart

Requery IP

Modify our MovaXterm connection configuration to our modified IP address and reconnect, and test whether it can access the external network

Then ping our server through this machine and you can access it normally.

At this point, the static IP setting is complete.

Firewall settings

The following configuration is not currently used in this example

-- Enable the firewall systemctl start firewalld 

-- View the firewall status systemctl status firewalld 

-- Open port firewall-cmd --permanent --zone=public --add-port=80/tcp

firewall-cmd --permanent --zone=public --add-port=22/tcp

firewall-cmd --permanent --zone=public --add-port=21/tcp

-- Restart the firewall service to make the configuration take effect firewall-cmd --reload

-- View the currently open port number firewall-cmd --list-port

Reference Documentation

Hyper-v: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/about/

This concludes this article on how to install Centos7 using a Hyper-v virtual machine. I hope it will be helpful for everyone’s study, and I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Netty client access process NioSocketChannel creation analysis
  • Netty distributed client processing access event handle source code analysis
  • Netty distributed NioEventLoop task queue execution source code analysis
  • Netty source code analysis NioEventLoop performs select operation entry
  • Netty distributed source code analysis monitors read events

<<:  Pure CSS3 code to implement a running clock

>>:  MySQL database JDBC programming (Java connects to MySQL)

Recommend

How to download excel stream files and set download file name in vue

Table of contents Overview 1. Download via URL 2....

A Preliminary Study on Vue Unit Testing

Table of contents Preface Why introduce unit test...

A complete list of commonly used HTML tags and their characteristics

First of all, you need to know some characteristi...

Vue implements file upload and download functions

This article example shares the specific code of ...

Talk about the understanding of CSS attribute margin

1.What is margin? Margin is used to control the sp...

Solution to mysql failure to start due to insufficient disk space in ubuntu

Preface Recently, I added two fields to a table i...

Sample code for testing technology application based on Docker+Selenium Grid

Introduction to Selenium Grid Although some new f...

Color matching techniques and effect display for beauty and styling websites

Color is one of the most important elements for a...

CentOS 6 Compile and install ZLMediaKit analysis

Install ZLMediaKit on centos6 The author of ZLMed...

An example of elegantly writing status labels in Vue background

Table of contents Preface optimization Extract va...