1. Prepare Springboot files
Before deployment, first prepare the springboot file in advance and open the idea.
Here I take my ruleback as an example. The project layout is as follows:
We click the maven button on the right and open Lifecycle here
We run clean and package in sequence
BUILD SUCCESS will appear after running
We find the address of our project and generate a new jar package here. All we have to do is upload this jar package to the Alibaba Cloud server and run it.
2. Upload the jar package to the Alibaba Cloud server
Here we open Alibaba Cloud Client and open file management.
If you don’t know how to open it, you can check the first part of the tutorial:
Deploy Alibaba Cloud Server from scratch (a must-read for newbies) - CSDN Blog
Here we select the file and upload the jar package.
After uploading it is as follows:
After the upload is completed, we return to the SSH connection interface:
First cd to our directory
cd /usr/local/java
Then use the jar command to run
java -jar ruleback-1.0-SNAPSHOT.jar
When you see Started here... it means it has been run successfully.
If we want to keep the project running in Alibaba Cloud, we need to stop the project with control+c first.
Then enter the code
nohup java -jar ruleback-1.0-SNAPSHOT.jar
The following code appears to indicate success
The project can continue to run.