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

An example of how JavaScript can prevent duplicate network requests

Preface During development, we often encounter va...

Analysis of JavaScript's event loop mechanism

Table of contents Preface: 1. Reasons for the eve...

Vue implements a search box with a magnifying glass

This article shares with you how to use Vue to im...

Summary of various postures of MySQL privilege escalation

Table of contents 1. Write Webshell into outfile ...

Complete steps for Nginx to configure anti-hotlinking

need: Usually, sites want to prevent videos and p...

Two ways to implement HTML page click download file

1. Use the <a> tag to complete <a href=&...

What hidden attributes in the form can be submitted with the form

The form elements with visibility=hidden and displ...

A brief discussion on common operations of MySQL in cmd and python

Environment configuration 1: Install MySQL and ad...

(MariaDB) Comprehensive explanation of MySQL data types and storage mechanisms

1.1 Data Type Overview The data type is a field c...

How to build a multi-node Elastic stack cluster on RHEL8 /CentOS8

Elastic stack, commonly known as ELK stack, is a ...

Detailed tutorial on installing MySQL database in Linux environment

1. Install the database 1) yum -y install mysql-s...

Some notes on mysql create routine permissions

1. If the user has the create routine permission,...

Detailed explanation of the principle of js Proxy

Table of contents What is Proxy Mode? Introducing...

A brief introduction to the command line tool mycli for operating MySQL database

GitHub has all kinds of magic tools. Today I foun...