Build a Linux environment on a virtual machine

1. Virtual machine environment preparation

Use virtual machines to build three Linux environments

1. Virtual machine installation

Step one: Open the VMware Workstation software, as shown in the figure below:
Step 2: Click "** Create Virtual Machine **", the "Welcome to the New Virtual Machine Wizard" interface will pop up, select "** Typical (Recommended) ( T) **", and then click "** Next **",As shown below:

 

Step 3: Select "** Install the operating system( s) later **", and then click "** Next **", such as
As shown below:
Step 4: Select "** Linux(L) **", then select "** CetOS64-bit **" in the version (V) drop-down box, and finally click "** Next **", as shown in the figure below :

 

Step 5: Write the name of the virtual machine (starting from any number) in the Virtual Machine Name (V) box, then select the installation location, and finally click "** Next **", as shown in the following figure:

Step 6: The maximum disk size is recommended to be "** 20GB or more **", then select "** Store the virtual disk as a single file (O) **", and finally click "** Next **", as follows As shown in the figure:

 Step 7: Click "** Finish **" to complete the creation of the virtual machine. As shown below:

 

2.CentOS7 installation

Step 1: Select the virtual machine you just installed, click "** Virtual Machine **" and then "** Settings **", as shown in the figure below:

 

Step 2: Select "** Memory **" and allocate a suitable memory size. For learning, it is recommended to use "** 4GB **". Then select "** Processor **". It is recommended to select "** for the number of processors" ** 2 **" Select "** 2 **" for the number of cores per processor , then select "** CD/DVD **", select "** Use ISO image file **" to find the ISO file, and finally Select "** Network Adapter **". It is recommended to select "** NAT Mode **" and click OK, as shown in the figure below:

 

Step 3: Turn on the virtual machine and select "** Install CentOS7 **" to enter the installation interface, as shown in the figure below:

 

Step 4: Select "** Chinese **" and click Continue, as shown in the figure below: 

Step 5: Click ** Installation Location **, select ** Local Standard Disk **, and click Finish; click ** Software Selection **, select ** GNOME Desktop **, and click Finish;

 

 Step 6: Click ** Start Installation ** to come to the user setting interface. First ** set the ROOT password **, and secondly ** create a user **, as shown in the figure below:

 

Step 7: Click ** Restart **.

Step 8: After restarting, click ** LICENSING **, ** Receive License **; then click ** System **, ** Connect Network **, and ** Set the host name **, and finally click to complete the configuration. As shown below:

 

Step 9: Click the username and enter the password to log in.

3. Configuration after installation of CentOS7 

(1) Modify the host name
vim /etc/hostname

(2) Turn off the firewall

systemctl stop firewalld
(3) Check firewall status
systemctl status firewalld
(4) Cancel firewall auto-start

systemctl disable firewalld
(5) Static IP configuration
①Edit network configuration file:
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
HWADDR=00:0C:29:B0:5F:08
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.159.101
GATEWAY=192.168.159.2
NETMASK=255.255.255.0
DNS1=192.168.40.2
DNS2=223.6.6.6
Need to modify:
HWADDR (mac address)
IPADDR (customize the IP address according to your own network segment), select an IP randomly according to the subnet network segment in NAT mode. For example, in this picture, I choose 192.168.159.101
GATEWAY (fill in the corresponding gateway address according to your own network segment) According to my network segment shown in the above picture, I set 192.168.159.2
②Close NetworkManager and cancel auto-start at boot
systemctl stop NetworkManager
systemctl disable NetworkManager
③Restart network service
systemctl restart network
(6) Check the default startup mode at startup
systemctl get-default
(7) Modify boot mode to command line mode
systemctl set-default multi-user.target
(8) Restart the virtual machine
reboot
(9) Add mapping relationship
①Under windows
#C:\Windows\System32\drivers\etc\hosts
192.168.159.101 master
192.168.159.102 node1
192.168.159.103 node2
②Under Linux
#vim /etc/hosts
192.168.159.101 master
192.168.159.102 node1
192.168.159.102 node2

 2. Install JDK

1. Delete the JDK that comes with the system

(1) Check whether Java software is installed
rpm -qa|grep "java"
(2) Delete the built-in JDK:
rpm -e 文件名 --nodeps

2.Install JDK _

(1) Create packages and soft directories
cd /usr/local/
mkdir packages
mkdir soft
(2) Upload jdk through xftp
(3) Unzip jdk to the soft directory
tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr/local/soft/
(4) Configure environment variables
vim /etc/profile
#JDK
export JAVA_HOME=/usr/local/soft/jdk1.8.0_171
export PATH=$JAVA_HOME/bin:$PATH
#Make environment variables effective
source /etc/profile
(5) Verification

 

3. Virtual machine cloning

1. First shut down the master virtual machine and clone two virtual machines: node1 and node2.

2. Click ** Snapshot Manager ** and select ** Clone **.

3. Click ** Next Page **. 

4. Select ** Current Status in the Virtual Machine ** and click ** Next Page **.

5. Select ** Create Full Clone ** and click ** Next Page **.

6. Enter the virtual machine name and virtual machine storage path, and click ** Finish **.

7. Modify the host names and networks of node1 and node2 respectively just like modifying the master node. 

Guess you like

Origin blog.csdn.net/qq_40322236/article/details/128632311