04 Centos actual site deployment

1. Problem description

A website developed with springboot has generated a jar, how to deploy it to centos?

2. Deployment records

  • For remote connection to centos, the tool I use is xshell, which is simple and easy to use. xshell comes with ftp tool, as shown below

Upload the jar package to the corresponding folder of the server, pay attention to the permissions, if not, you can use the chmod command to authorize.

  • Build the java operating environment first, such as jdk:

Due to the development and use of springboot, tomcat etc. have been integrated, so there is no separate build.

  • Use the java command to run the jar package, but considering that the website needs to run in the background, use nohup and &, as follows:
nohup java -jar xxx.jar >xxx.out &

This command can run the jar package in the background, and can also output the log to the xxx.out file I specified. The function of the> symbol is to redirect the output

  • How to view the log, I use the following command:
more xxx.out
  • Use the ps command to view the running process, I use the following code to view the java process, in order to find the process ID number
ps -ef|grep java|grep -v grep
  •  Know the ID number of the process, if you want to kill the process, you can use the following command:
kill -9 ID号

Usage scenario: The program is definitely under continuous development and iteration, so once a new version is released, I need to find the currently running process, close it, and then re-run the new version of the jar package.

 

 

Guess you like

Origin blog.csdn.net/sunlylqq/article/details/112388388