Intellij IDEA constructs SpringBoot in detail in the previous blog “Intellij IDEA constructs SpringBoot in detail” introduced the idea constructs SpringBoot detailed process, and in “CentOS Installation Tomcat” introduced the Tomcat installation. The previous articles have in fact fully prepared the necessary conditions for deploying Linux. So today we will see how to deploy SpringBoot on CentOS and get your SpringBoot running on the server.

VLinux deployment springboot

5 steps from 0 to 1 to deploy SpringBoot on Linux Tomcat:

1. CentOS FTP Service Installation

2. CentOS Install Java JDK

3. CentOS Installation Tomcat

4. Detailed Explanation of Intellij IDEA SpringBoot Construction

5. SpringBoot Introduction (2)CentOS Deployment SpringBoot Project from 0 to 1.

VIntelliJ IDEA of packaging

1.1 Setting the Packaging Jar

1.2 Compiling plug-ins. Skip this step if the SpringBoot template is created according to intellij Idea Construction SpringBoot

<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId>  </plugin> </plugins> </build>Copy the code

1.3 Select “Edit Configurations” at the top right of IntelliJ IDEA and add a Maven configuration

Perform A, B, and C in sequence, as shown in the figure above

1.4 Then enter “Clean Package” in the Command line and click the green triangle icon to run. As shown below:

1.5 The package is successfully packaged, as shown in the following figure

Vspringboot deployment CentOS

2.1 Transferring Files to the CentOS Server.

If FileZilla has a problem connecting to centos, refer to the centos FTP Service Installation guide.

2.2 When the JAR package is located, run the Java -jar zuche-0.0.1 -snapshot.jar command

Java -jar zuche-0.0.1 -snapshot. jar –server.port=80

If the preceding figure is displayed, the deployment succeeds.

2.3 computer open a browser on the client input address http://10.168.11.106:8080/index no configuration port, is the default.

OK, the obtained effect is consistent with the local effect demonstrated by intellij IDEA Construction SpringBoot in detail.

2.4 If the JAR package application with port 80 is deployed, a message indicating that port 80 is occupied will be displayed during the next deployment.

ERROR message: ERROR 48608 – [the main] o.a pache, catalina. Core. StandardService: Failed to start the connector [connector [HTTP / 1.1-80]]

Check whether port 80 is in use lsOF -i:80

Locate the process 35986 ps 35986

Kill process kill -9 35986

Tomcat directory curl -i localhost:8080

V Common commands

3.1 Checking the Tomcat Directory sudo find / -name * Tomcat *

Under root, recursively search the root directory for the name of the file that contains the tomcat field. You may find a lot of files, but you should be able to locate tomcat.

In case you are not sure if the directory is Tomcat, look for the directory that might be Tomcat and then ls to see the structure within the directory.

3.2 Viewing real-time running logs Tail -f Catalina. out

The 3.2.1 tail command writes the file to standard output from the specified point. You can use the -f option of the tail command to easily check the log file that is being changed. Tail -f filename displays the tail content of filename on the screen and refreshes it to see the latest file content. Ctrl+ C exits the tail command.

3.2.2 Format: tail[required parameters][Selection parameters][file]

3.2.3 Function: Used to display the content at the end of a specified file. If no file is specified, it is processed as input information. View log files frequently.

3.2.4 parameters:

-f Indicates the reading cycle

-q Indicates that processing information is not displayed

-v Displays detailed processing information

-c< Number > Number of bytes to display

-n< number of rows > Number of rows to be displayed

–pid= Pid is used with -f to terminate the process after the process ID,PID, dies.

-q, –quiet, –silent never prints the header of the given filename

-s, –sleep-interval= s This parameter is used with -f to sleep for seconds at each repeated interval

3.2.5 Example: Tail -n 5 Catalina.2018-10-07.log Displays the last five lines at the end of the file

3.3 Viewing Port Information netstat-tln

3.4 check the Tomcat process information ps – ef | grep Tomcat

3.5 Viewing the Current Working Directory (PWD :print working Directory) PWD

Windows view Tomcat 3.6 port netstat ano | findstr searches in 8080

3.7 Linux Changing the Network IP Address

3.7.1 Going to the network configuration directory CD /etc/sysconfig/network-scripts

3.7.2 Editing the configuration file vim ifcfg-ens33

Ensure that the server (VM) and the local host are in the same IP address segment. Important important important!!

Note: If the deployment fails, the firewall may be faulty

If the system is centos7, run the systemctl status firewalld.service command to check the firewall status

After systemctl stop firewalld.service is disabled, you can access the page

V Blog Summary

From the CentOS FTP Service Installation, To CentOS install Java JDK to CentOS install Tomcat to details intellij IDEA build SpringBoot “SpringBoot Introductory tutorial (2)CentOS deployment SpringBoot project from 0 to 1”.

IntelliJ IDEA package spring Boot project and then deploy to CentOS server, from 0 to 1 all finished.

About the author: Focus on basic platform project development. If you have any questions or suggestions, please feel free to comment! Copyright notice: The copyright of this article belongs to the author and the blog garden, welcome to reprint, but without the consent of the author must retain this statement, and give the original text link in a prominent place on the page of the article. For the record: all comments and messages will be answered as soon as possible. You are welcome to correct your mistakes and make progress together. Or direct private message I support the blogger: if you think the article is helpful to you, you can click on the lower right corner of the article [recommendation]. Your encouragement is the author to adhere to the original and continuous writing of the biggest power! \