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

A brief analysis of whether using iframe to call a page will cache the page

Recently, I have a project that requires using ifr...

Mysql 5.7.18 Using MySQL proxies_priv to implement similar user group management

Use MySQL proxies_priv (simulated role) to implem...

Detailed explanation of the life cycle of Angular components (Part 2)

Table of contents 1. View hook 1. Things to note ...

Analysis of examples of using anti-shake and throttling in Vue components

Be careful when listening for events that are tri...

A brief introduction to Linux environment variable files

In the Linux system, environment variables can be...

How to use Volume to transfer files between host and Docker container

I have previously written an article about file t...

In-depth understanding of the use of r2dbc in MySQL

Introduction MySQL should be a very common databa...

Implementation of Nginx configuration Https security authentication

1. The difference between Http and Https HTTP: It...

js to implement verification code interference (dynamic)

This article example shares the specific code of ...

CSS implementation code for drawing triangles (border method)

1. Implement a simple triangle Using the border i...

Solve the problems encountered when installing MySQL 8.0 on Win10 system

The problems and solutions encountered when insta...

Vue3 Documentation Quick Start

Table of contents 1. Setup 1. The first parameter...

Detailed explanation of CentOS configuration of Nginx official Yum source

I have been using the CentOS purchased by Alibaba...

HTML table layout example explanation

The elements in an HTML document are arranged one...