Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Linux system CentOS 7 configure Spring Boot runtime environment

Shulou Source: shulou.com Published: 2022-06-03 03:34:14 10月04日 Update

A new Linux server bought from Aliyun is used to deploy SpringBoot applications. Due to the previous use of the Debian version, the environment configuration is different and cumbersome. This article mainly introduces the process of configuring SpringBoot environment under CentOS.

New user

Since there are only root users in the new machine, there will be some security problems if you use root users to perform various operations directly, so let's create users first.

Please refer to this article: create a new user

Install Oracle Java 8

Spring Boot is a Java-based framework, so we need to install Java 8 first.

Please refer to this article: install JDK 8

Install MySql5.7

Since it is a J2EE function, we must have a database, and we use MySQL5.7 here.

Please refer to this article: install MySQL5.7

Install Nginx

We need Nginx to perform the reverse proxy of the service (domain name / IP).

Please refer to this article: install Nginx

Install the Spring boot project to serve the system, and start automatically when the server starts.

When we deploy the Spring boot application, when the server restarts, we need our application to start with the system at the same time, so we need to register our application as a system service to achieve self-startup.

Please refer to this article: configure service implementation self-startup

Note:

The ExecStart in this article is a jar package made by Spring boot, and the following configuration should be added to the project's build.gradle so that the jar package can be executed on the command line.

Add: to the build.gradle of the project:

Version 1.x:

SpringBoot {executable = true}

Version 2.x:

BootJar {launchScript ()} more

At this point, the server environment is ready to run a basic Spring Boot J2EE project. If you need more detailed configuration, please refer to my other blogs.

Tags: Service article reference configuration user project server application environment system version at the same time run different security tedious indispensable function blog only Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi MySQL Microsoft Shulou Tech Info