Detailed tutorial on VMware installation of Linux CentOS 7.7 system

Detailed tutorial on VMware installation of Linux CentOS 7.7 system

How to install Linux CentOS 7.7 system in Vmware, and it is a minimal installation. Then make necessary configuration changes and implement basic optimizations. Finally take a snapshot.

Install Linux CentOS 7.7

Installation requirements: The installed virtual machine is used as a server, so the installation should be minimal. Do not install any unnecessary software or a graphical interface.

How to create a virtual machine, see: "How to create a virtual machine and set up a virtual machine network in VMware"

Start the virtual machine

insert image description here

Install CentOS 7

Select (use the up and down keys to switch options) the first one, install CentOS 7

insert image description here

Keyboard and language selection

Select the keyboard mode, language and country (for example: American English, British English, Indian English, Australian English, Canadian English, etc.)

insert image description here

Select time zone

Select: Asia/Shanghai

insert image description here

insert image description here

Software Installation

Minimal installation

insert image description here

insert image description here

Disk partitioning

Manual partitioning

insert image description here

insert image description here

insert image description here

/boot partition disk size allocation

insert image description here

/ Root partition disk size allocation

insert image description here

The result after partitioning

insert image description here

Partitioning takes effect

insert image description here

Install the system and set the root password

insert image description here

insert image description here

insert image description here

insert image description here

insert image description here

System configuration modification

Note: After installation, there is no ifconfig command

Hostname modification

Do not use the default hostname

[root@localhost ~]# vim /etc/hostname
zhang
[root@localhost ~]# hostname zhang

After the operation is completed, log in again and you will find that the hostname has been changed.

Network card modification

The default network card name is not eth0, eth1. Therefore, modifications need to be made.

insert image description here

Modify the grub file and take effect

Modify the /etc/default/grub file and add net.ifnames=0 to the variable GRUB_CMDLINE_LINU to disable the new naming rule.

insert image description here

[root@zhang ~]# cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="net.ifnames=0 crashkernel=auto spectre_v2=retpoline rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

After saving, you need to regenerate the grub configuration file and update the kernel parameters. To do this, we need to run:

# grub2-mkconfig -o /etc/grub2.cfg # The result is as follows 

insert image description here

Rename the network card and modify the file configuration

Rename NIC

# cd /etc/sysconfig/network-scripts/
# mv ifcfg-ens33 ifcfg-eth0
# mv ifcfg-ens37 ifcfg-eth1

eth0 (intranet) file content after modification

[root@zhang network-scripts]# cat ifcfg-eth0 
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPV6INIT=yes
USERCTL=no
IPADDR=172.16.1.100
NETMASK=255.255.255.0

eth1 (external network) file content after modification

[root@zhang network-scripts]# cat ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPV6INIT=yes
USERCTL=no
IPADDR=10.0.0.100
NETMASK=255.255.255.0
GATEWAY=10.0.0.2
DNS1=223.5.5.5
DNS2=223.6.6.6

Remark:

eth1's IPADDR=10.0.0.100 is used as the external IP. Since it is a virtual machine created by VMware on a personal computer, there will be no real public IP configuration. Therefore, the 10.0.0.0/8 network segment was used as the external IP. GATEWAY=10.0.0.2 is set globally in the VMware virtual machine. See: "How to create a virtual machine and set up a virtual machine network in VMware" DNS1=223.5.5.5 and DNS2=223.6.6.6 are the DNS addresses of Alibaba Cloud. It is best not to use Google's 8.8.8.8, because this foreign IP may be restricted.

# systemctl restart network.service

Restart the network card service to make it effective.

ifconfig installation

insert image description here

It can be seen that the Internet is normal

How to Install ifconfig Command

# yum search ifconfig # Check which tool package the command is in # yum install -y net-tools 

insert image description here

Execute ifconfig command

insert image description here

After installation, system basic optimization

# Related URLs:
https://github.com/zhanglianghhh/system-install/blob/master/linux-CenetOS7/basedOptimi_7.sh

Specific optimization points:

  • CentOS base mirror source and epel mirror source
  • Disable and disable selinux
  • Disable and close the firewall
  • Create a normal user and elevate privileges (direct login as root is not allowed in production environments)
  • Time synchronization (synchronize with Alibaba Cloud's time server)
  • How long to disconnect if no operation is performed and the number of historical command records saved (the script is commented, please remove the comments as needed)
  • Add aliases to some commands. Purpose: To display colors and make it easier to view information. For example: alias grep='grep --color=auto'; alias ls='ls --color=auto', etc.
  • Save user operation records to the system log. This way if something goes wrong, there is a history to trace back
  • System file handle number settings
  • Kernel parameter optimization
  • Hide system kernel parameters and set login welcome message
  • SSH configuration optimization
  • Necessary packages installed. For example: bash-completion, lrzsz, sysstat, nmap, tree, telnet, dos2unix, nc, vim, etc.

Snapshot management [Important ★★★★★]

After completing the above steps, the entire Vmware Linux CentOS 7.7 deployment is actually complete. But there is another important step that must be completed.

We use this virtual machine as a template. Other virtual machines are cloned from this virtual machine, and the cloned state is the current state of the virtual machine. This is also to ensure that the current state of the virtual machine can be restored even if it is changed. So we need to make a snapshot to save the current state of the virtual machine.

Shut down the client. To save disk space, we shut down the computer first and then take a snapshot.

insert image description here

Select Snapshot Management

insert image description here

Enter a snapshot name and description. It must be meaningful, otherwise after a long time you won’t know what it is.

insert image description here

Snapshot completed

insert image description here

Related Reading

「How to create a virtual machine and set up a virtual machine network in VMware」

This is the end of this detailed tutorial on how to install Linux CentOS 7.7 system with VMware. For more information about installing CentOS 7 with VMware, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Windows uses VMware to create a Linux virtual machine and install the CentOS7.2 operating system
  • Tutorial on installing CentOs7 with VMware in win7 to build a Linux environment
  • Detailed configuration steps for installing Linux (CentOS) under VMware virtual machine
  • Linux Learning CentOS (I) ---- Install CentOS 7 in VMware Virtual Machine (Graphic Tutorial)
  • VMware installs Linux system on virtual machine
  • VMWARE installation and Linux system installation under VMWARE (graphic tutorial)
  • Install Linux using VMware virtual machine (CentOS7 image)

<<:  Summary of solutions for MySQL not supporting group by

>>:  Example of making XML online editor using js

Recommend

Vue's global watermark implementation example

Table of contents 1. Create a watermark Js file 2...

Solution to mysql error code 1064

If the words in the sql statement conflict with t...

Detailed steps for installing and configuring MySQL 8.0 on CentOS

Preface Here are the steps to install and configu...

Web page HTML code: production of scrolling text

In this section, the author describes the special...

A brief discussion on the problem of forgotten mysql password and login error

If you forget your MySQL login password, the solu...

KVM virtualization installation, deployment and management tutorial

Table of contents 1.kvm deployment 1.1 kvm instal...

How to call the browser sharing function in Vue

Preface Vue (pronounced /vjuː/, similar to view) ...

Common front-end JavaScript method encapsulation

Table of contents 1. Enter a value and return its...

Detailed explanation of MLSQL compile-time permission control example

Preface The simple understanding of MySQL permiss...

Solution to the problem that Centos8 cannot install docker

Problem [root@zh ~]# [root@zh ~]# [root@zh ~]# yu...

Solve the problem of inconsistent MySQL storage time

After obtaining the system time using Java and st...

Upgrade MySQL 5.1 to 5.5.36 in CentOS

This article records the process of upgrading MyS...

Tomcat Server Getting Started Super Detailed Tutorial

Table of contents 1. Some concepts of Tomcat –1, ...

A brief introduction to VUE uni-app core knowledge

Table of contents specification a. The page file ...

VMware Workstation is not compatible with Device/Credential Guard

When installing a virtual machine, a prompt appea...