About cloud Linux deployment tomcat server (Maven's multi-module war package)

  The operating environment of the blogger:

  Computer system: Linux mint 18

  JDK version: java version "1.8.0_171"

  Maven version: Apache Maven 3.5.3

1. About the generation of war package:

  

  As shown in the figure, this is a multi-module project, which is divided into front-end and back-end. The generated war package will be generated in the web part, but the web part depends on the service part, so we need to generate the jar package of the service part first to ensure that The war package of the web part is successfully generated:

  Generate the jar package of the service part:

  

  After seeing the build, the maven repository is successfully placed:

  

  Next we need to generate the war package for the web:

  

  We can see that it was successfully generated and placed under cn/zuoyu/ssm/ssm-web/:

  

  So now many newbies will ask, just deploy the web.war package, what about the service project? To know that the web has a strong dependence on services, let's open the war package:

  

  Clearly see that there are four folders

  

  Seeing that there is something we want to know in the WEB-INF directory, will the class file of the service be in the classes directory? Let's see:

  

  There is nothing in this, let's see if there is anything we want to see in the lib directory:

  

  If you look closely, you will see the ssm-service-0.0.1-SNAPSHOT.jar package, which is the jar package of the service we just generated, then let's see if there is anything we want in this package:

  

  As you can see here, all the contents of the service are in this jar package, so we only need to deploy the web.war package.

2. Upload to the cloud Linux server:

  Cloud server system: contes 6.5

  JDK version: java version "1.8.0_112"

  tomcat version: Apache Tomcat/9.0.0.M15

  First we need to connect to ssh:

  The format is #ssh user@IpAddress

  

  Let's take a look at the address of tomcat and enter:

  

  Let's now take a look at the webapps directory:

  

  Empty, nothing but its own. Now we need to upload the local war package to the directory of the cloud server (for convenience, I renamed the war package to zuoyu.war and put it in this directory:

  

  Now it needs to be uploaded to the cloud server:

  Small episode, if we upload the file from the server to the local  scp username@servername:/path/filename  /var/www/local_dir (local directory)

      if we upload locally to server  scp /path/filename username@servername:/path
      if we download whole directory from server  scp -r username@servername:/var/www/remote_dir/ (remote directory) /var/www/local_dir (local content)

      If we upload the directory to the server  scp -r local_dir username@servername:remote_dir

  

  Uploaded successfully! Let's see if there is any on the server:

  

  ok, the upload is successful, now we start the server! If it starts successfully then it will automatically decompress the zuoyu.war package:

  

  We can see that tomcat has started, let's take a look at the startup log:

  

  Take a look at the webapps directory:

  

  Very complete, let's visit the browser and try it:

  

  very perfect!

  Don't ask about the future, but do good deeds!

 

 

 

 

 

 

 

 

 

 

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325108269&siteId=291194637