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

MySQL Basics Quick Start Knowledge Summary (with Mind Map)

Table of contents Preface 1. Basic knowledge of d...

Introduction to the usage of exists and except in SQL Server

Table of contents 1. exists 1.1 Description 1.2 E...

Vue implements an example of pulling down and scrolling to load data

Table of contents Step 1: Installation Step 2: Ci...

Understand the initial use of redux in react in one article

Redux is a data state management plug-in. When us...

Vue+webrtc (Tencent Cloud) practice of implementing live broadcast function

Table of contents 1. Live broadcast effect 2. Ste...

Commonly used JavaScript array methods

Table of contents 1. filter() 2. forEach() 3. som...

Implementing file content deduplication and intersection and difference in Linux

1. Data Deduplication In daily work, there may be...

Introduction to MySQL isolation level, lock and MVCC

This article aims to clarify the relationship bet...

Vue+ssh framework to realize online chat

This article shares the specific code of Vue+ssh ...

Ubuntu installation cuda10.1 driver implementation steps

1. Download cuda10.1: NVIDIA official website lin...

Ubuntu opens port 22

Scenario You need to use the xshell tool to conne...