Since returning the Mac, the original notebook has been idle. The configuration of this notebook is still good, and it can install several virtual machines for the practice of building small clusters.

The preparatory work

Install VMWare

VMware Workstation 15 Pro 15.5.6 Build-16341506

There is not much to say about the installation steps.

Download the Linux distribution

Because I am used to using CentOS for my cloud server, I also use CentOS this time

Version: CentOS 7

Can download in tsinghua mirror station, generally download 4.5g or so of this

Creating a VM

  1. Open thevmware ,File -> Create a VM

  1. Create a new wizard, select Custom, and next

  2. Compatibility, default, next

  3. CD image file Select the ISO file you just downloaded, next

  4. Set user name and password (root is not used here, root is created by default)

  5. Select the vm file location based on the hard disk space of the PC

  6. CPU configuration, memory configuration, depending on your situation, the default configuration is chosen for this demonstration

  7. Network type: Set this parameter to a bridge network. Otherwise, the VM network cannot communicate with the external network

  8. I/O controller type, hard disk type, and default Settings are selected here


  1. Configure the maximum disk size based on the disk size

  2. After everything is configured, click Finish to start the installation. Pour a cup of tea and wait for a few minutes

    Vmware automatically configures centos installation options. Continue drinking tea and waiting

  3. The installation is complete. When this interface appears, the system has been installed

Configure the network

Why configure the network?

After entering the system, open the terminal software, ping Baidu, found that ping is impassable, host machine is also impassable, there is no network is certainly not good

How to configure it?

  1. Add a network in bridge mode to vmware virtual Machine Network editor

    Note that the following two networks are set to host-only mode and the host connection is shown as connected

  2. Check whether the virtual machine has a network adapter. If not, add one and set it to bridge mode


  1. Input at terminaldhclient, you need torootUser permissions, first switch toroot , su root
su root

dhclient
Copy the code
  1. Enter ifconfig to view ens36 or ENS33

  2. Modify ens36 configuration file, go to /etc/sysconfig/network-scripts, check whether there is ifcfg-ens36 or ifcfg-ens33 file, if there is, edit it. If not, you need to create a file to configure, you can directly copy the following configuration.

    Some of them are important:

    1. BOOTPROTO: Specifies staticstatic, the subsequent IP address will not change
    2. NAME DEVICE: must be consistent with what you see in the file NAME and ifconfig which is both hereens36
    3. ONBOOT: yes Starts with the system
    4. IPADDR NETMASK GATEWAY DNS1: Configure the IP addresses in the same IP address segment as those in the LAN based on your network configuration192.168.199. *
    TYPE=Ethernet
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=static
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=ens36
    UUID=824ec4bd-a9AE-4410-8346-17ce7f3DD111 DEVICE= ENS36 ONBOOT=yes IPADDR=192.168.199.212 NETMASK=255.255.255.0 GATEWAY=192.168.199.1 DNS1 = 192.168.199.1Copy the code

    Save the modification and exit

  3. Restarting the Network Service

    systemctl restart network.service
    Copy the code
  4. Check to see if the network is working

[test@localhost network-scripts]$ping www.qq.com ping public-v6.sparta.mig.tencent-cloud.net (220.194.111.148) 56(84) bytes 64 bytes from www.qq.com (220.194.111.148): Icmp_seq =1 TTL =53 time=9.56 ms 64 bytes from www.qq.com (220.194.111.148): Icmp_seq =2 TTL =53 time=13.4 ms 64 bytes from www.qq.com (220.194.111.148): Icmp_seq =3 TTL =53 time=20.3 ms 64 bytes from www.qq.com (220.194.111.148): Icmp_seq =4 TTL =53 time=9.19 ms 64 bytes from www.qq.com (220.194.111.148): Icmp_seq =5 TTL =53 time=9.92 ms 64 bytes from www.qq.com (220.194.111.148): Public-v6.sparta.mig.tencent-cloud.net ping statistics -- 6 packets transmitted, public-v6.sparta.mig.tencent-cloud.net ping statistics -- 6 packets transmitted, Received 6, 0% packet loss, time 5009 RTT min/avg/Max/ms mdev 20.327/3.999 = 9.195/11.994 / ms [test@localhost network-scripts]$ping 192.168.199.119 ping 192.168.199.119 (192.168.199.119) 56(84) bytes of data.64 bytes From 192.168.199.119: ICmp_seq =1 TTL =64 time=1129 ms 64 bytes from 192.168.199.119: Icmp_seq =2 TTL =64 time=130 ms 64 bytes from 192.168.199.119: Icmp_seq =3 TTL =64 time=82.8 ms 64 bytes from 192.168.199.119: Icmp_seq =4 TTL =64 time=120 ms 64 bytes from 192.168.199.119: Icmp_seq =5 TTL =64 time=30.8 ms 64 bytes from 192.168.199.119: Icmp_seq =6 TTL =64 time=25.4 ms 64 bytes from 192.168.199.119: Icmp_seq =7 TTL =64 time= 703 ms ^C -- 192.168.199.119 ping statistics -- 7 packets transmitted, 7 received 12% packet loss, time 7011 RTT min/avg/Max/ms mdev 1129.858/370.829 = 25.445/226.124 / ms, pipe 2Copy the code

SSH connection using terminal tools, can be connected to prove that the network is no problem


note

  1. There are a few holes in network configuration that need to be explained. Note that there are a few points in writing this article that are different from my previous practice

    1. In the network adapter, all the VMS installed before are available by default. There is no one here, so you need to manually add one on your mobile phone
    2. In the DHClient, the network adapter is provided by default before, so the generated network name is ENS33, which was generated once before when there was no adapter, yesloAfter the adapter is added, it is generated again and found that the name isens36Slightly different from before,/etc/sysconfig/network-scriptsThere is no ens36 configuration file in the directory, so you need to create a new file. All previous VMS have ENS33 by default, so you only need to make some changes. This is for personal understanding but the name is different, the configuration can be.
  2. After I installed the system here, the time zone is wrong, you can change it in the system

  3. It is often not enough to set up a node in a cluster, and it is too troublesome and time-consuming to reinstall the node. You can clone the VM and modify the corresponding network configuration