Home > Java > javaTutorial > How to deploy SpringBoot project to cloud server

How to deploy SpringBoot project to cloud server

王林
Release: 2023-05-13 12:49:18
forward
2348 people have browsed it

1. Set the Maven packaging type

Set it to jar here.

According to my experience, packaging into war is a pitfall and requires Tomcat, and you will encounter many problems when deploying for the first time.

If you package it into a jar, you don’t need to install Tomcat. You can start the project with just one command: java -jar codergroup-1.0.0-SNAPSHOT.jar.

How to deploy SpringBoot project to cloud server

2. Packaging the SpringBoot project

I use IntelliJ IDEA here, directly in the Maven plug-in, click package to package.

How to deploy SpringBoot project to cloud server

Then you can see it in the target of the project

How to deploy SpringBoot project to cloud server

Upload the jar file to the server

3. Install MySQL and JDK

In order to facilitate the management of project files and maintenance pressure, I chose to install the Pagoda panel here

Install MySQL5.5## directly in the Pagoda panel

#Then import the database

So the process of installing MySQL is not introduced here

About the use of the Pagoda panel: refer here

The installation of JDK only requires one line of commands and no need Configure environment variables

yum -y install java-1.8.0-openjdk*

4. Start the project

We know that the command to start the jar project is the java -jar jar file Name

But this kind of startup is a foreground startup, that is, when the command line window is closed, the project will be closed.

So we need to start in the background, the command is

nohup java -jar codergroup-1.0.0-SNAPSHOT.jar >temp.txt &

How to deploy SpringBoot project to cloud server

Explain:

nohup runs without hanging up

>temp.txt writes the output in the command line to temp.text

& Automatically run

We view the content in temp.txt, project

How to deploy SpringBoot project to cloud server

The above is the detailed content of How to deploy SpringBoot project to cloud server. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template