This is the first day of my participation in the August Challenge. For details, see:August is more challenging

The body of the

The whole process

1. Download CentOS7

  1. Baidu search centos–>
  2. Go to centos official Website link –>
  3. Click on the DVD ISO – >
  4. Click on the ap. Stykers. MOE/centos 7.6…. Connect to download.

2. Install the VM management software

Windows Installation Tutorial

Mac Installation Tutorial

VMware Fusion configuration Nat static IP – Zhishengqianjun’s blog – CSDN

After the VM is installed, the VM shortcut is generated on the desktop

3. Create a VM

3.1 Starting THE VM Management Software

After the VM management software is installed, double-click the shortcut on the desktop

Start the VM management software as shown in the following figure:

As shown below, click File -> Click New VM -> Select typical (recommended)(T) by default -> Click Next

As shown below, click “Install OS later “–> Click Next

Select Linux(L)- > CentOS7 64-bit -> Next

Enter the name BaseCentos7 as shown in the figure below. Select a basic VM from which subsequent cluster nodes will be cloned

After entering the VM name,

1. Click Browse -> Select vm location -> Select this computer -> select and expand local disk C

2. Create a layer folder myProgram (vm root directory) –>3nodesvm–> Basecentos (VM root directory)

3. Select C:\ myProgram \3nodesvm\basecentos directory as the storage directory for BaseCentos7

4. Create node1,node2, and node3 in C:\ myProgram \3nodesvm\ to store vm disk files for the next three nodes.

5. Select the Basecentos directory and click Next.

As shown in the figure below, change the maximum disk size from the default 20GB to 200GB (change the maximum disk size from the default 20GB to 200GB).

Click Finish to complete the creation of the virtual machine. Wait for two or three seconds and you will see the created virtual machine

The following figure shows the created VM:

3.2 Modifying the Memory and CPU

Click Memory > Select Memory > enter 2048 on the right to adjust the VM memory to 2 GB

After entering the memory value, select CPU. Set the number of processors and the number of cores to 2

Click ok as shown below.

The following figure shows the Settings of memory and CPU.

3.3 Selecting the Centos7 image File

Here are two pictures:

1. Click on the CD/DVD

2. Click on the CD/DVD (IDE)

3. Click use the ISO image file

4. Click Browse

5. Select the downloaded Centos7 image file

6. Click Open

7. Click OK to finish selecting the image file

Click ok as shown below

3.4 Installing centos

Click start this virtual machine as shown below

If the image below appears, click I have installed

Wait until the automatic countdown reaches 0 and the system installation starts….

1. Click Install Tools. 2. Click Continue

Click DATE&TIME as shown below

Select the time zone and click Done

Click INSTALLATION SOURCE as shown below

Select the disk and click Done

After the disk selection is complete, Begin Installation becomes available in blue. Click Begin Installation to continue to the next step

As shown in the figure below, click set the password of administrator root to root, which is the same as the user name, easy to remember.

Wait for the installation progress to complete, so the perfect start has been successful half, patience to wait….

After the installation is complete, click Reboot to restart.

After the vm is restarted, localhost login :(colon) is displayed with a blinking white bar, where localhost indicates the current host name. The vm installation is complete.

Enter the user name root and the password root. At this time, you only need to enter the password, but the interface does not display. After entering, press enter to log in successfully as shown in the figure below:

After successful login, [root@localhost ~]# is displayed

Run the init 0 command and press enter to shut down the centos Linux system and download the software. Take a snapshot for the newly installed VM to prevent errors during the software installation. You can use the snapshot to restore the vm to the newly installed state.

4. Create a snapshot

Create a snapshot by following steps 1 to 5. View the created snapshot in 6,7, and 8. You are advised to create a snapshot for the key steps in the later operation.

4. Configure the environment

After the snapshot is created, start the VM and log in to the system as user root with the root password.

4.1 Stopping the Firewall

#Stopping the firewall
[root@localhost ~]#systemctl stop firewalld
#Disable the firewall from starting with the system
[root@localhost ~]#systemctl disable firewalld
#Viewing the Firewall Status
[root@localhost ~]#systemctl status firewalld
Copy the code

Firewall operations are as follows:

4.2 disable selinux

#Set the value of SELINUX to Disabled
[root@localhost ~]# vi/etc/selinux/config
#Check whether the configuration is complete
[root@localhost ~]# cat /etc/selinux/config
Copy the code

5. Configure the VM network

5.1 Opening the Virtual Network Editor

5.2 Setting the Virtual Network and Subnet

Select VMnet8 as shown below, click change Settings, and click Yes

Select VMnet8, enter 192.168.200.0 for the subnet IP address, and 255.255.255.0 for the subnet mask

Click NAT setting, enter gateway IP192.168.200.2(the IP address must be 192.168.200.2, not 192.168.200.1 this IP address has special purpose, you can know), and click OK

Click OK here to complete the virtual network configuration.

5.3 Configuring vm Networks

BaseCentos- > Right-click Settings to open VM Settings

Select network Adapter -> Select Custom (U): Specific Virtual Network -> OK to complete the vm network Settings.

5.4 Configuring VM IP Addresses

[root@localhost ~]#vi /etc/sysconfig/network-scripts/ifcfg-ens33 Add the following content at the end of the ifcfg-ens33 file: IPADDR=192.168.200.10 NETMASK=255.255.255.0 GATEWAY=192.168.200.2 # consistent with the GATEWAY in the virtual network configuration DNS1=8.8.8.8 DNS2=144.144.144 After the configuration, save the file
#Restarting a NETWORK adapter
[root@localhost ~]#systemctl restart network
#Ping Baidu's official website To ensure that VMS can access the Internet, facilitating the later online installation of dependent software
[root@localhost ~]#ping www.baidu.com
Copy the code

6. Install xshell

This tool can be very convenient to operate Linux, such as connecting to the Linux command line, through the XFTP file transfer tool can upload files to Linux

6.1 xshell installation

Double-click XShell4.exe to install as shown above

If the following prompts click yes, this is Win8, Win10 and other operating systems to provide a prompt mechanism for security.

Start the installation

Click Next

Select as shown below and click Next

Select as shown below and click Next

Select as shown below and click Next

Select as shown below and click Next

Click Install as shown below

Click Finsh to complete the installation.

6.2 XFTP installation

Double-click xftp4.exe to install it

Again, if the image below appears, click Yes

Start the installation

Click Next

Select as shown below and click Next

Select as shown below and click Next

Select as shown below and click Next

Click Install as shown below

6.3 Xshell and XFTP usage

Generate shortcuts to Xshell and XFTP on your desktop after installing xshell and XFTP.

Double-click the Xshell4 shortcut key to run XShell

Click open as shown below

Enter the name Basecentos (for each virtual machine connection) and the IP address of the virtual machine to be connected, as shown below

Click User Authentication, enter user name (root) and password (root), and click OK

Create the following session connection (Basecentos) and click Connect

As shown in the figure below, xshell needs to save the user name and password of the connection user when connecting to the VM for the first time. You can not enter the user name and password in the next login to facilitate later login.

As shown in the figure below, we have successfully logged in to the Linux system of basecentos.

Now that we have finished using Xshell to connect to Linux, we will find that the font is too small and uncomfortable to look at. Let’s adjust the font as shown below:

Click the image below, select the 16-point font on the right, and click OK to complete the setting.

7. Upload the JDK

Upload the downloaded JDK to the Linux system that we have installed. By default, we use the root user to install JDK.

At this point we need to upload the JDK installation package using XFTP

Click the XFTP button as shown below to open the XFTP tool

The XFTP window is as follows:

Select the JDK installation package in the Linux environment on the left, hold down the left mouse button and drag it directly to the right, then release the mouse, you can see the following upload progress.

The upload is complete.

Once the upload is complete we can close the XFTP window and return to the Xshell command window.

Enter ll in the xshell command window and press Enter. As shown in the following figure, you can see the JDK installation file just uploaded.

8. To install the JDK

So far, we have uploaded the JDK installation package to the working directory of Linux root user through the XFTP tool, and then we will install it.

8.1 to install the JDK

[root@localhost ~]# rpm -ivh jdk-8u211-linux-x64.rpm
Copy the code

The following figure shows the JDK installation process

As shown below, the JDK installation is complete

8.2 Configuring Java Environment Variables

1. Find the JDK installation directory

#Start by using the find command to find the Java installation directory
[root@localhost ~]# find / -name java
/etc/alternatives/java
/etc/pki/ca-trust/extracted/java
/etc/pki/java
/var/lib/alternatives/java
/usr/bin/java
/usr/java
#Java (JDK) installation directoryThe/usr/Java/jdk1.8.0 _211 amd64 / bin/Java/usr/Java/jdk1.8.0 _211 amd64 / jre/bin/Java/root @ localhost ~ #Copy the code

2. Configure environment variables

Run the vi command to modify the. Bash_profile file in the root directory

[root@localhost ~]# vi .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
#Java Environment variablesJAVA_HOME = / usr/Java/jdk1.8.0 _211 - amd64#Java environment variables are added to pathPATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH ~ (Force to save) :wq! [root@localhost ~]# vi .bash_profile#usesourceCommand to make the environment variables take effect
[root@localhost ~]# source .bash_profile
#Run the Java -version command to check whether Java environment variables are configured successfully
[root@localhost ~]# java -version
#According to the Java version"1.8.0 comes with _211"Indicates that the Java environment variable (JAVA_HOME) has been configured successfully.Java Version "1.8.0_211" Java(TM) SE Runtime Environment (build 1.8.0_211-B12) Java HotSpot(TM) 64-bit Server VM (build 25.211-b12, mixed mode) [root@localhost ~]#Copy the code

9. Configure time synchronization

In the later construction of the big data cluster, the time between all nodes should be the same, so we need to synchronize the time between nodes and the time center when building the cluster.

9.1 Installing the Time Synchronization Software

# yum install -y ntpdate # yum install -y ntpdate # yum install -y ntpdate

[root@localhost ~]# yum install -y ntpdate Loaded plugins: fastestmirror Determining fastest mirrors * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: Mirrors.tuna.tsinghua.edu.cn base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00... Complete!Copy the code

9.2 Configuring Periodic Time Synchronization

#Run the crontab -e command to add the scheduled time synchronization configuration
[root@localhost ~]# crontab  -e   
#After running the crontab -e command, press I on the keyboard to enter the editing mode, enter the content, and then press ESC in the upper left corner of the keyboard to enter the command modeshiftEnter :(colon), and enter wq! Press Enter to finish saving.
#The following configuration indicates that the time is synchronized every minute
*/1 * * * * /usr/sbin/ntpdate us.pool.ntp.org;
~                                                                                                                                                                                            
:wq!

#Wait about one minute and run the date command to check whether the system time is synchronized
[root@localhost ~]# date
Sun Jun 30 10:51:17 CST 2019
[root@localhost ~]# 
Copy the code

10. Install net-tools

Net-tools is a Linux network troubleshooting tool, we often use it to check the cluster network operation

[root@localhost ~]# yum install -y net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
--->Package Net-tools. x86_64 0:2.0-0.24.20131004 Git. el7 will be installed
--> Finished Dependency ResolutionDependencies Resolved ================================================================================================ Package Arch Version Repository Size ================================================================================================ Installing: Net-tools x86_64 2.0-0.24.20131004 Git. el7 Base 306 K Transaction Summary ================================================================================================ Install 1 Package Total  download size: 306 k Installed size: 918 k Downloading packages: Net - tools - 2.0-0.24.20131004 git. El7. X86_64. RPM | 306 kB 00:00:00 Running transaction check Running transaction test Transaction test Succeeded Running Transaction Installing: NET-tools-2.0-0.24.20131004 Git.el7.x86_64 1/1 Verifying: Net-tools-2.0-0.24.20131004 git.el7.x86_64 1/1 Installed: Net-tools. x86_64 0:2.0-0.24.20131004git.el7 Complete! [root@localhost ~]#Copy the code

11. Clone the VM

In order to ensure that the configuration of all our machine environments is consistent, we need to clone virtual machines. At the same time, we only need to install Linux operating system on one virtual machine, and Linux operating system is installed on the cloned machine. This saved us the time we had to repeat Linux installations and reduced the number of configuration errors we had across multiple host systems.

So now we need to build a three-machine cluster, so we need three machines. We cloned three from one machine.

11.1. Stop the running VM

To clone a VM, stop the running VM.

[root@localhost ~]# init 0Copy the code

In the figure below, we see that xshell’s connected Basecentos session has been closed

11.2 Cloning a VM

Switch to the home screen of our virtual machine management software, VMware Workstation, and continue with the following steps.

1. Figure below, in BaseCentos7

Click Next

Click Next

Click Next

As shown in the following figure, enter the vm name and select the path C:\ myProgram \3nodesvm\node1 for storing the first VM (if the path does not exist, please install such a path layer and create it by yourself).

Click close as shown in the picture below to complete the clone

After the vm clone operation is complete, clone two VMS node2 and Node3 using the same method above. After the operation is complete, the three VMS are completely created as shown in the following figure.