How to install Linux CentOS 7.7 system through VMware

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

Install Linux CentOS 7.7

Installation requirements: The installed virtual machine is used for the server, so the installation should be minimized, no redundant software, and no graphical interface.

How to create a virtual machine see: "VMware How to Create a Virtual Machine and Set Virtual Machine Network"

Start the virtual machine

Install CentOS 7

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

Keyboard and language selection##

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

Choose time zone##

Choice: Asia/Shanghai

Software Installation##

Minimal installation

disk partition##

Partition manually by yourself

/boot partition disk size allocation

/ Root partition disk size allocation

Results after partition

Partition effective

Install the system and set the root password##

System configuration modification#

Note: After installation, there is no ifconfig command

Host name modification##

Don't use the default hostname

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

After the operation is complete, 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. So it needs to be modified.

Modify the grub file and take effect###

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

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

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

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

Rename the network card name and modify the file configuration###

Network card rename

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

eth0 (intranet) modified file content

1[ root@zhang network-scripts]# cat ifcfg-eth0 
 2 DEVICE=eth0
 3 TYPE=Ethernet
 4 ONBOOT=yes
 5 NM_CONTROLLED=yes
 6 BOOTPROTO=none
 7 IPV6INIT=yes
 8 USERCTL=no
 9 IPADDR=172.16.1.10010 NETMASK=255.255.255.0

eth1 (external network) modified file content

1[ root@zhang network-scripts]# cat ifcfg-eth1
 2 DEVICE=eth1
 3 TYPE=Ethernet
 4 ONBOOT=yes
 5 NM_CONTROLLED=yes
 6 BOOTPROTO=none
 7 IPV6INIT=yes
 8 USERCTL=no
 9 IPADDR=10.0.0.10010 NETMASK=255.255.255.011 GATEWAY=10.0.0.212 DNS1=223.5.5.513 DNS2=223.6.6.6

Remarks:

  1. The IPADDR of eth1=10.0.0.100 here is used as an external network IP. Since it is a virtual machine created by VMware on a personal computer, there will be no real public network IP configuration. Therefore, the 10.0.0.0/8 network segment is used as the external network IP.
  2. GATEWAY=10.0.0.2 is set globally in the Vmware virtual machine. See: "VMware how to create a virtual machine and set up a virtual machine network"
  3. DNS1=223.5.5.5 and DNS2=223.6.6.6 are the DNS addresses of Alibaba Cloud.
  4. 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, it will take effect.

ifconfig install##

It can be seen that the Internet is normal

How to install ifconfig command

1 # yum search ifconfig       #Query which toolkit the command is in
2 # yum install -y net-tools

Execute ifconfig command

System basic optimization after installation#

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

Specific optimization points:

  1. CentOS base mirror source and epel mirror source
  2. Turn off and disable selinux
  3. Close and ban the firewall protection wall
  4. Create an ordinary user and can escalate rights (the production environment is not allowed to log in directly with root)
  5. Time synchronization (synchronize with Alibaba Cloud's time server)
  6. How long does it take to disconnect and save history command records without any operation (the script is commented, please remove the comment as needed)
  7. Add aliases to some commands. Purpose: Display colors to make it easier to view information. Such as: alias grep='grep –color=auto'; alias ls='ls –color=auto' etc.
  8. Save the user's operation record to the system log. So if there is a problem, there are historical records to trace back
  9. System file handle number setting
  10. Kernel parameter optimization
  11. Hide system kernel parameters and set login welcome message
  12. SSH configuration optimization
  13. The necessary packages are 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 has actually been completed. But there is an important step that must be completed.

This virtual machine is used as a template, and other virtual machines are cloned from this virtual machine, and the cloned is the state of the virtual machine at the moment, and to ensure that the current state of the virtual machine can be restored even if it is changed . So we need to take a snapshot to save the current state of the virtual machine.

Shut down the client, in order to save disk space, so we shut down first, and then take a snapshot.

Choose snapshot management

Write the name and description of the snapshot. It must be meaningful, otherwise I don't know what it is after a long time.

Snapshot finished

Related Reading#

"VMware how to create a virtual machine and set up a virtual machine network""

complete!


———END———
If you feel good, pay attention (-^O^-)!

Recommended Posts

How to install Linux CentOS 7.7 system through VMware
Use VMware15 to install Linux (CentOS6.5)
How to install Centos operating system on VMware virtual machine
How to install RPM packages on CentOS Linux
How to quickly install docker on Linux (Centos version)
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TensorFlow on CentOS 8
How to install TeamViewer on CentOS 8
How to install PHP7.4 in CentOS
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Go on CentOS 8
How to install GCC on CentOS 8
How to install Yarn on CentOS 8
How to install Nginx on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Vagrant on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install HDP2.6 in Centos7.2
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to install OpenCV on CentOS 8
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install JDK and Mysql on Ubuntu 18.04 linux system
Vmware install CentOS6
How to install Android SDK in centos7
Graphic KVM to install CentOS7.6 operating system
How to install Apache Maven on CentOS 8
Install mysql8.0.13 version under Linux CentOS7 system
How to install Apache Kafka on CentOS 7
How to install MySQL on Ubuntu 18.04 (linux)
[Graphic] How to install tomcat on centos
R&D: How To Install Python 3 on CentOS 7
How to install GCC compiler on CentOS 7
How to install offline JDK1.8 on centos7.0
CentOS7 system yum way to install MySQL5.7
How to install vim editor under Linux (Ubuntu 18.04)
How to install and configure Elasticsearch on CentOS 7
How to install Visual Studio Code on CentOS 8
How to install and use Docker on CentOS 7
How to install openssh from centos 7 source code
How to install and configure VNC on CentOS 8
Install CentOS under VMware
Linux (CentOS7) using RPM to install mysql 8.0.11 tutorial
Linux Centos7 install jdk1.8