Deploy the Spring Boot project for Linux cloud services

This is the 28th day of my participation in the August Text Challenge.More challenges in August

Background:

Before two weeks of time, made a simple blog website, the website: click into, after the local can be used normally, want to deploy to the server, to the big guy see a joy, so there is this deployment article.

A brief introduction to the blog:

  1. Modeled after small and beautiful, the front-end template also uses small and beautiful implementation.
  2. Technical points: springBoot+ Thymeleaf +mysql+Mybatis- Plus (mixed XML implementation)

This blog will not maintain, the role is to sort out the previous learned knowledge, increase memory points.

Without further ado, let’s begin!

Environment building:

To avoid version-compatibility issues with projects, install versions of the same project.

The package name The version number
maven 3.6.3
jdk 9
mysql Latest version (with pit)

Tools required:

  1. Xshell (Linux)
  2. Xftp(File Transfer)
  3. Navicat (Database Connection)
  4. Linux(cloud server) 9 new users a month.

There is no cloud mysql here.

Deployment process:

Project packaging:

  1. clear
  2. package

Example of successful packaging:

Upload to cloud server:

There are many software that can be uploaded on the interface. (Personal: Xftp software)

If a friend has deployed it before, it should be clear.

I divided two bags:

  1. Javapro houses JDK and system files
  2. MVN places the Maven installation package

The configuration file can be modified at any time to make the project take effect.

Decompression command:

The tar - ZXVF package nameCopy the code

Configure the JDK and Maven environment:

Enter the JDK folder:

CD jdk-9.0.4/ root@iZuf67gh3nsadi0q4sg7ulZ:~/javapro/jdk-9.0.4# PWD /root/javapro/jdk-9.0.4Copy the code

With the operation:

CD apache-maven-3.6.3/ root@iZuf67gh3nsadi0q4sg7ulZ:~/ MVN /apache-maven-3.6.3# PWD /root/mvn/apache-maven-3.6.3Copy the code

To remember the current path, type:

vi /etc/profile
Copy the code

As follows:

Export JAVA_HOME=/root/javapro/ jdK-9.0.4 ## Export PATH=.:$JAVA_HOME/bin:$PATH#mvnThe export PATH = $PATH: / root/MVN/apache maven - 3.6.3 / binCopy the code

Follow the format above and fill in your own path.

After exiting, load:

source /etc/profile
Copy the code

Final verification:

java -version
mvn -version
Copy the code

As follows:

MVN - version Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /root/ MVN /apache-maven-3.6.3 Java version: 9.0.4, Vendor: Oracle Corporation, Runtime: /root/javapro/ JDK-9.0.4 Default locale: en_US, platform Encoding: UTF-8 OS name: "Linux ", version: "5.4.0-47 - generic", the arch: "amd64," family: "unix" -------------------------------------------------------------------------------- java -version java version "9.0.4" Java(TM) SE Runtime Environment (Build 9.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11) Mixed mode) root @ iZuf67gh3nsadi0q4sg7ulZ: ~ / MVN/apache maven -- 3.6.3 #Copy the code

MySQL > install MySQL

MySQL installation before actually also written, but did not expect the torture is also tortured here.

First of all, install mysql online, use the official website installation package, download to Linux decompression error, originally thought that the package is wrong, but found on the Internet tutorial, or not solved, so the implementation of online installation.

If I know this kind of mistake of friends, can comment exchange.

Here’s the link to my previous online installation article

MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL > install MySQL >

  1. Mysql8.0 has been used for remote authorization login, but the original mysql8.0 authorization mode error
  2. Version 5 can be configured using the original article, but MySQL8 cannot be licensed to itself.

MySQL8 permission verification solution: Create a new user, remotely connect to this user.

<br>mysql> create user 'xbhog'@The '%' identified by 'xbhog'; Query OK, 0 rows affected (0.02sec) mysql> mysql> mysql>GRANT ALL PRIVILEGES ON*. *TO 'xbhog'@The '%';
Query OK, 0 rows affected (0.04 sec)
 
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
 
mysql> ALTER USER 'xbhog'@The '%' IDENTIFIED WITH mysql_native_password BY 'Corresponding to your own password'; Query OK, 0 rows affected (0.02sec) mysql>flush privileges; Query OK, 0 rows affected (0.01sec)Copy the code

Navicat connection requires a change of encryption:

If Navicat connection returns do not support caching_sha2_password authentication error. Change the authentication mode of remote access users to msyql_native_password.ALTER USER 'username'@The '%' IDENTIFIED WITH mysql_native_password BY 'password';
 
FLUSH PRIVILEGES;
Copy the code

Launch project:

Java-jar jar package name (blog-0.0.1 - snapshot.jar)Copy the code

Background operation:

Nohup java-jar jar package name (blog-0.0.1 - snapshot.jar)Copy the code

Reference:

MySQL8 problem

The end:

If you see this or happen to help you, please click 👍 or ⭐ thank you;

There are mistakes, welcome to point out in the comments, the author will see the modification.