Cgb2005 - Jingtao 9 (environment configuration of virtual machine using Ping remote connection tool Linux system project: install JDK MariaDB and configure firewall)

Cool breeze AAA 2022-02-13 07:43:45 阅读数:828

cgb2005 cgb jingtao environment configuration

explain

1. virtual machine :
Install virtual machine The official website of the operating system download
Virtual machine environment configuration ( see ip windows linux)
modify windows ip test :ping
2.MobaXterm:
Operating a remote tool is equivalent to operating a black window
3. Virtual machine snapshot description
4.linux Project deployment
Deploy jdk install linux The database of mysql Import sql file Configure database access To configure linux Firewall policy Connect the test

1 install VMware virtual machine

linux , Introduction to virtual machine To configure Use The command is in the document of the pre class material .

1.1 Demand analysis

The current project is deployed in windows Under the system , In fact, projects are often deployed in linux Under the system , install VM Virtual machine is equivalent to windows Open up a memory space under the system , This space consists of windows management .

1.2 step

1). Software download
A little …( It can be downloaded from the Internet , Check other people's blogs for specific steps .)
2). Check the page effect after installation
 Insert picture description here
3). Checking NIC
If you don't have a network card, change it VMware Version installation of …
 Insert picture description here
4). start-up linux System
hold linux Unzip it to a directory without Chinese .
 Insert picture description here
 Insert picture description here
5). Start virtual machine
1. This username and password , yes linux In the system , In the pre class materials linux The configuration is already configured .
2. If you shut down the virtual machine , The state of the database will disappear , The next day, you need to restart the database before connecting , And hang it up and use it directly the next day .
 Insert picture description here

 Insert picture description here

1.3 error analysis

solve : If the following error occurs , Need to go to BIOS Turn on Virtualization settings in the system . See Baidu for details .
 Insert picture description here

1.4 Operating system download

https://centos.org/
 Insert picture description here

2 Virtual machine environment configuration

2.1 Demand analysis

problem :windows and linux Want to communicate ,ip Must be in the same network segment .( The network card is now in windows In the system, so and windows In the same network segment )
solve : modify ip Just stay in the same network segment (windows It's easy to change ).
 Insert picture description here

Inquire about windows The network card in the system ip:ipconfig .
vm8 Of ip:192.168.26.1
 Insert picture description here
see linux Of ip:ip addr
192.168.126.129
 Insert picture description here

2.2 modify ip

2.2.1 Modify virtual machine cyberspace

 Insert picture description here
 Insert picture description here
 Insert picture description here

2.2.2 modify NAT Set up

 Insert picture description here
 Insert picture description here
 Insert picture description here

2.2.3 modify DHCP( Domain name resolution ) Set up

 Insert picture description here

2.2.4 test (ping once )

Reopen DOS Window to view the changed ip.
 Insert picture description here
stay windows Access through network card in the system linux System , So in windows in ping Next linux.
 Insert picture description here

2.2.5 Error resolution

Check the teacher's blog

3 Connect Linux Server tools

3.1 Business scenario

The company's servers are generally located in the company's computer room , But ordinary employees can't go in and out at will . And if the service needs to be handled but the personnel are not in the company, how to deal with it is more serious ( The current operation is equivalent to computer operation connected to the computer room ), Therefore, we need to install some remote link tools to realize remote office .

3.2 Remote link tool description

Tools :xshell 、MobaXterm etc. ( It is equivalent to operating the black window ).
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here
Run the test :
 Insert picture description here

 Insert picture description here
Be careful : Operating this window is equivalent to operating linux Black window .
 Insert picture description here

4 Virtual machine snapshot description

explain : The current virtual machine state can be recorded by snapshot .
principle : Once you click on the snapshot of the virtual machine, all linux Back up your files , and linux All operations are processed in a file based manner .
1). take snapshot
 Insert picture description here
2). Restore the snapshot
 Insert picture description here

5 Linux Project deployment

5.1 About the process of service deployment

technological process :windows System access linux System , First, through hosts File for domain name resolution , Through nginx Request distribution to the agent (linux Not yet nginx, For the time being windows In the installation of nginx Server for ), Then access the specific server through the firewall , When accessing the database with access rights turned on .
explain :windows Of nginx The server wants to take effect , Be prepared to hosts file . If you want to access someone else's system, you must pass through someone else's firewall . The data comes from the database , The database has a security level and is not allowed to be accessed by others at will , Therefore, you need to open the database permission .
Be careful : In this flowchart nginx Deploy to windows In the system , Therefore, if you want domain name access, you need to configure nginx Of conf Reverse proxy files , No direct configuration ip+ Port number access . But it's actually linux When your project is published ,nginx Is configured in linux In the system .
 Insert picture description here

5.2 Deploy Linux JDK

Empty the working directory . stay linux The system uses jdk Certainly linux Version of .
 Insert picture description here

5.2.1 Upload JDK

file location .
 Insert picture description here
analysis : If your company's server is in Shanghai , You are now in Henan , What do you do with jdk Upload the file to the server in Shanghai ?
solve : Remote upload via protocol .
MobaXterm Use sftp agreement .
 Insert picture description here

5.2.2 decompression JDK

command : tar -zxvf jdk-8u51-linux-x64.tar.gz
 Insert picture description here
 Insert picture description here

If you want to use this compressed file in the future , It's a pity to delete it at this time , So you can create a directory to save the compressed file .
step : Create a directory software, hold jdk Move the compressed package to this directory , And decompress the jdk Change the name to a shorter one .
 Insert picture description here

5.2.3 To configure JDK environment variable

explain : If modification is needed JDK Of environment variable You need to Modify specific files .
Location : /etc/profile
matters needing attention : because profile Your files are system files , Make sure you're right Otherwise the whole Linux The order will not take effect .
command : vim /etc/profile Add "/" The calculation starts from the root directory
 Insert picture description here
 Insert picture description here

explain : export Indicates an external statement .

# Set up jdk Environmental Science
export JAVA_HOME=/usr/local/src/jdk1.8 # To go to the company, you just need to change this path
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib

Refresh to make environment variables take effect : source /etc/profile
Check jdk Environmental Science :java -version

 Insert picture description here

5.3 install linux database mariadb

5.3.1 Check the network connection

Test whether the current virtual machine can correctly link to the Internet . ctrl +c Universal key combination end , Otherwise, it will always be ping down .
 Insert picture description here

5.3.2 download MariaDB database

1). Command interpretation : yum From linux The mall is equipped with a service . install Said the installation Followed by the name of the installation

[root@localhost src]yum install mariadb-server
[root@localhost src]yum clean all # Empty installed files If the download fails .

 Insert picture description here

2). Confirm Download ( Prompt to download dependent packages y determine )
 Insert picture description here
3). Installation completion tips
 Insert picture description here

5.3.3 Database start

command :

 1. Start command [root@localhost src]# systemctl start mariadb
2. Restart command [root@localhost src]# systemctl restart mariadb
3. The shutdown command [root@localhost src]# systemctl stop mariadb

5.3.4 Database initialization operation ( Premise database started )

command : mysql_secure_installation
Be careful : The first time to enter the direct enter, Then set the password :root , Last always y
 Insert picture description here

5.3.5 Test whether the database user name and password are valid

user name , password :root
Exit database : exit
Note that it is troublesome to uninstall the database , Just go back to the snapshot .
 Insert picture description here

5.4 Import sql file

5.4.1 Upload sql file

 Insert picture description here

5.4.2 Import to database

1). command : source /xxx/xxxx/xxxx/jtdb.sql;( Log in to the database first )
 Insert picture description here
2.) Import : Because the database is installed in src Directory and sql File at same level , So we can use relative path here .
 Insert picture description here

5.5 sqlyog Remote connection database

explain :
1. If you need to connect to the database remotely, you must pass through the firewall
2. If you connect to the database remotely , Remote access must be enabled in the database , Otherwise, refuse to connect .
 Insert picture description here

5.6 To configure Linux Database permissions

5.6.1 Switch database to mysql

 Insert picture description here

5.6.2 modify user surface

1). Check the data sheet
user: User login form .
 Insert picture description here
2). Inquire about user In the table host/root/password
You can see that currently only local access is allowed .
 Insert picture description here
3). take host=“localhost” Change it to “%” % For any ip The address can be accessed , But the user name and password are required to be correct .
 Insert picture description here
4). Refresh database permissions
 Insert picture description here

5.7 To configure Linux Firewall policy

5.7.1 Check firewall status

command : firewall-cmd --state
running: Representative opens .
 Insert picture description here

5.7.2 Firewall configuration

explain : There is a configuration file in the firewall , Said when Linux How the firewall should operate when the system starts !!!
demand : tell linux The system does not need to start the firewall after boot The default is enabled
command :
1.systemctl disable firewalld.service ( This is the configuration of turning off the firewall , But the firewall is not turned off .)
2.systemctl enable firewalld.service ( Start firewall configuration )
 Insert picture description here

5.7.3 Manually turn off the firewall

explain : Manually shut down the firewall by command ( Turn off the firewall during the test , After measurement Just open it when publishing )
command :
1. systemctl stop firewalld.service( Turn off firewall )
2. systemctl start firewalld.service( Turn on the firewall )
 Insert picture description here

5.8 sqlyog Database remote testing

At this time, you are importing sql The file can be passed sqlyog Imported .
 Insert picture description here

copyright:author[Cool breeze AAA],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130743416491.html