VMware Workstation Pro 16 Graphic Tutorial on Building CentOS8 Virtual Machine Cluster

VMware Workstation Pro 16 Graphic Tutorial on Building CentOS8 Virtual Machine Cluster

In daily study and work, we often need to use distributed cluster environments, such as nacos cluster, mysql cluster, zookeeper cluster, redis cluster, big data cluster, etc., but there are usually not so many physical machines available. Therefore, it is a good choice to build a distributed cluster environment for development and testing through virtual machines. So today we will try to build a CentOS 8 cluster using VMWare under Windows 10.

Preparation

Hardware environment: Since you are installing a virtual machine, the hardware configuration of the physical machine itself should not be too low. The environment I use is a desktop computer with Windows 10 64-bit, i7 32G 256g SSD + 1T hard drive.

Software installation package: VMware Workstation 16, CentOS-8.2.2004-x86_64-dvd1.iso.

Install VMware Workstation Pro 16

VMware Workstation is a very easy-to-use virtual simulator. Its powerful functions and convenient usage make it the most used virtual machine brand in the world.

1. Download VMware Workstation Pro 16 and CentOS8 installation packages from the official website;

insert image description here

2. Double-click VMware-workstation-full-16.1.0-17198959.exe to start the installation;

3. Enter the installation interface and click [Next]

insert image description here

4. First check "I accept the terms in the license agreement", then click [Next]

insert image description here

5. Select the software installation path. It is installed in the C drive by default. Click [Change] to modify the installation path. Note: the installation path folder name cannot contain Chinese characters!

insert image description here

Here, install the software in the D drive folder, and then click [Next]

insert image description here

6. Uncheck "Check at startup..." and "Join VMware...", then click [Next]

insert image description here

7. Click [Next]

insert image description here

8. Click [Install]

insert image description here

9. Installing, this process will take about 1 minute, please wait patiently...

insert image description here

10. Installation is complete. VMware Workstation Pro is now installed.

insert image description here

Creating a Linux Virtual Machine

1. Click Create New Virtual Machine

insert image description here

2. Select Custom (Advanced) configuration and click Next

insert image description here

3. Select the default Workstation 16.X when selecting virtual machine hardware compatibility, and click Next

insert image description here

4. Select Install the operating system later and click Next

insert image description here

5. Select Linux as the client operating system and CentOS 8 64-bit as the version, and click Next

insert image description here

6. Fill in the virtual machine name and specify the virtual machine installation location (it is not recommended to install it to the C drive), click Next

insert image description here

7. Processor configuration, I choose 2 cores here, you can modify it as needed, click Next

insert image description here

8. Virtual machine memory, because my memory is sufficient, choose 4G, you can modify it as needed, click Next

insert image description here

9. Set the network type, set it to the default NAT, and click Next

insert image description here

10. Select the I/O controller type, select the default LSI Logic here, and click Next

insert image description here

11. Select the disk type, select the default SCSI here, and click Next

insert image description here

12. Select Create a new virtual disk here and click Next

insert image description here

13. I choose 40G for disk capacity, and leave other settings as default. Click Next.

insert image description here

14. Set the disk file location and click Next

insert image description here

15. You are ready to create the virtual machine, click Finish

insert image description here

16. Click Edit Virtual Machine Settings on the main interface, select the downloaded CentOS8 image file, and click Confirm. The virtual machine is now created.

insert image description here

Set the network mode

VMware provides us with three network working modes, namely: Bridged (bridge mode), NAT (network address translation mode), and Host-Only (host-only mode).

Open the vmware virtual machine, we can see VMnet0 (bridge mode), VMnet1 (host only mode), VMnet8 (NAT mode) in the "Virtual Network Editor" under "Edit" in the option bar, so what are the functions of these? In fact, the VMnet0 we see now represents the virtual switch used in bridge mode; VMnet1 represents the virtual switch used in host-only mode; VMnet8 represents the virtual switch used in NAT mode.

NAT (Network Address Translation)

Here we use NAT (Network Address Translation mode), open vmware, click "Virtual Network Editor" under "Edit", click Change Settings

insert image description here

Set the NAT mode options in the virtual machine, set NAT parameters and DHCP parameters.

insert image description here

NAT Settings

insert image description here

DHCP Settings

insert image description here

Install CentOS8

1. Click "Power on this virtual machine"

insert image description here

2. If the error message is "This host supports Intel VT-x, but Intel VT-x is disabled"

insert image description here

VMware prompts that this host supports Intel VT-x, but Intel VT-x is disabled. What's going on? The full name of Intel VT-x is Intel Virtualization Technology, which is Intel virtual technology. Enabling it allows the hardware platform to run multiple operating systems at the same time. It is one of the necessary technologies for running virtual machine software. If disabled, a prompt will pop up saying "This host supports Intel VT-x, but Intel VT-x is disabled". The solution is to enter BIOS and enable Intel Virtualization Technology. You can refer to this link for solutions http://www.xitongcheng.com/jiaocheng/xtazjc_article_38955.html. Different brands and models have different solutions.

3. Enter the system installation page –> Select Install CIentos8 Linux 8 and wait for a while

insert image description here

4. Language settings, set according to your preferences, I choose Chinese here, click Continue

insert image description here

5. Installation information summary, here you need to set the installation destination, network and host name, time and date

insert image description here

Enter the installation target location interface and click Finish

insert image description here

Network and host name (it is best to turn on the network, otherwise it will be difficult to configure later)

insert image description here

Set the host name and click Apply.

insert image description here

Time and date, set to Asia/Shanghai

insert image description here

The interface after setting is as follows, click to start installation

insert image description here

During the installation process, the waiting time is slightly longer, about 10 minutes, and you can configure the user and password

insert image description here

This is convenient for memorization. Set the root user password to root and click Finish.

insert image description here

Installation complete, click Restart

insert image description here

Setting up licenses

insert image description here

Check I accept the license agreement and click Finish

insert image description here

Return to the initial settings interface and click End configuration

insert image description here

Log in as a user, enter system configuration, and click forward

insert image description here

Turn off location services and click forward

insert image description here

Online account, click Skip

insert image description here

Set your full name and user name (for later login), click forward

insert image description here

Set a password (for later login). For easy memorization, set it to root here, then click Next.

insert image description here

Click to start using

insert image description here

Check the network connection, enter the interface, open the terminal, and check the IP

insert image description here

Test Network

insert image description here

Other Configuration

Change the server to a static IP

Change to static IP, modify the corresponding configuration of BOOTPROTO and ONBOOT

vim /etc/sysconfig/network-scripts/ifcfg-ens33 

insert image description here

Restart the network after modification

nmcli c reload ifcfg-ens33

Check the firewall status

systemctl status firewalld 

insert image description here

Turn off firewall

Turn off firewall

systemctl stop firewalld 

insert image description here

Set the firewall not to start at boot

systemctl disable firewalld 

insert image description here

View startup items

insert image description here

Change to Alibaba Cloud yum source

Due to domestic network reasons, if your server is in China, installing some software on CentOS may be slow, so we need to change the system software source

It is recommended to change the yum source to a domestic source, such as Alibaba Cloud, as follows:

yum install wget -y
yum install curl -y

Backup

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
mv /etc/yum.repos.d/CentOS-PowerTools.repo /etc/yum.repos.d/CentOS-PowerTools.repo.backup
mv /etc/yum.repos.d/CentOS-Extras.repo /etc/yum.repos.d/CentOS-Extras.repo.backup
mv /etc/yum.repos.d/CentOS-centosplus.repo /etc/yum.repos.d/CentOS-centosplus.repo.backup
mv /etc/yum.repos.d/CentOS-AppStream.repo /etc/yum.repos.d/CentOS-AppStream.repo.backup

All the above files need to be renamed, because Centos-8.repo in Alibaba Cloud source contains all the above files. If you only change CentOS-Base.repo file according to the traditional method, the following prompt will appear:

Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repository AppStream is listed more than once in the configuration
Repository extras are listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration

Modified to Alibaba Cloud

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

Run yum makecache to generate cache

yum clean all
yum makecache

Install JDK

Put the jdk-8u191-linux-x64.tar.gz installation package in the /usr/local directory and unzip the installation package

tar -zxvf jdk-8u191-linux-x64.tar.gz

Configuring environment variables

vi /etc/profile

Add environment variables to configure Java

JAVA_HOME=/usr/local/jdk1.8.0_191
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH CLASSPATH

Reload environment variables

source /etc/profile

Check if the installation was successful

java -version

Building a cluster environment

Cloning a virtual machine

Create a virtual machine snapshot for backup

Right-click the virtual machine, click Snapshot, and then click Take Snapshot

Fill in the name and click Take Snapshot. The snapshot is now created.

insert image description here

Shut down the virtual machine, right-click the virtual machine, click Power, and click Shut Down Client

insert image description here

Shut down the virtual machine, right-click the virtual machine, and click "Manage" - "Clone"

insert image description here

Click "Next"

insert image description here

Set the clone source and click Next.

insert image description here

Set the clone type, select Create a full clone, and click Next.

insert image description here

Enter the virtual machine name and location, then click Finish.

insert image description here

When cloning is complete, click Close.

insert image description here

Repeat the steps above to create a virtual machine slave2

The cloning is completed like this

insert image description here

Adjustment test

So far, we have created a total of 3 virtual machines, and the configurations of these 3 virtual machines are exactly the same. Therefore, as a most basic usable cluster, we still need to make some minor adjustments.

We change the IP addresses of CentOS-8_64-slave1 and CentOS-8_64-slave12 to 192.168.138.9 and 192.168.138.10 respectively. For details, refer to the previous steps修改為靜態ip,修改BOOTPROTO和ONBOOT對應的配置

Change the hostname of the three virtual machines. Modify to master, slave1, slave2 in sequence

hostnamectl set-hostname slave1

Restart the VM

reboot

The result is this

Master corresponding IP: 192.168.138.8

insert image description here

slave1 corresponding ip: 192.168.138.9

insert image description here

Slave2 corresponding ip: 192.168.138.10

insert image description here

There is no problem for the master to ping the corresponding IP addresses of slave1 and slave2

insert image description here

At this point, the cluster of three virtual machines, master, slave1, and slave2, has been built.

The author uses MobaXterm to access three virtual machines. There is currently no need for password-free login between clusters. If there is a need, you can handle it yourself.

You may also be interested in:
  • How to set up a shared folder on a vmware16 virtual machine
  • How to view the IP address of Linux in VMware virtual machine
  • In-depth understanding of the Java virtual machine stack and memory model
  • Detailed steps to install CentOS7 system on VMWare virtual machine
  • 20 Selected Java Virtual Machine Interview Questions

<<:  This article will show you how JavaScript garbage collection works

>>:  HTML Basics: HTML Content Details

Recommend

js implements clock component based on canvas

Canvas has always been an indispensable tag eleme...

How to use Font Awesome 5 in Vue development projects

Table of contents Install Dependencies Configurat...

How to use Docker containers to implement proxy forwarding and data backup

Preface When we deploy applications to servers as...

Method of Vue component document generation tool library

Table of contents Parsing .vue files Extract docu...

Implementation of Vue single file component

I recently read about vue. I found a single-file ...

A brief introduction to mysql mycat middleware

1. What is mycat A completely open source large d...

Optimizing JavaScript and CSS to improve website performance

<br /> In the first and second parts, we int...

TCP third handshake data transmission process diagram

The process packets with the SYN flag in the RFC7...

Some findings and thoughts about iframe

This story starts with an unexpected discovery tod...

js to achieve simulated shopping mall case

Friends who are learning HTML, CSS and JS front-e...

How to connect a Linux virtual machine to WiFi

In life, the Internet is everywhere. We can play ...

Theory: The two years of user experience

<br />It has been no more than two years sin...

Summary of 4 solutions for returning values ​​on WeChat Mini Program pages

Table of contents Usage scenarios Solution 1. Use...