Ubuntu deploy Tomcat Web Services

  Installed in Ubuntu platform TomCat

tomcat

   This article will introduce TomCat how to deploy in the Ubuntu platform with QuickStart you use TomCat

  TomCat Profile


  Tomcat is a core project of the Apache Software Foundation (Apache Software Foundation) in Jakarta project by the Apache, Sun and other companies and individuals to develop from. Tomcat server is a free open source Web application server, are lightweight application server, it is not widely used in many occasions small and medium systems and concurrent user access is the preferred development and debugging JSP program.

  Of course, you can also simply believe that it is a can resolve JSP program plug-in Apache when a machine configured the Apache server, you can use it to respond HTML ( Standard Generalized Markup Language access an application under) page request. But the problem came Apache server can not respond to an access request to access JSP page alone program, so we need to use this plug-in to help TomCat respond to the Apache. However, most say is an extension of Apache Tomcat server, but running it is run independently, so when you run TomCat, it actually as a separate process with Apache running alone.

  Download and install the software


    Required software: JDK, TomCat (which is related to choose their own version.)

    The demo version of the software:

    JDK software versions: the JDK-8u221

    TomCat software version: the Apache-Tomcat-9.0.26

    Ubuntu system versions: Ubuntu 18.04 64-Wei

    View Ubuntu version:  lsb_release -a

    Charles look at the system: uname -a 

    Note: The test is recommended to use the root user to operate, the default Ubuntu does not allow direct root user login, set the root password 

 

   First, download the JDK, TomCat

  1. Download JDK

 JDK is the foundation of all java applications, java applications are all built on top of this. It is a set of API, it can be said that some of the java Class (class). JDK java program is to develop a set of things, tomcat is made to open up the java program.

  Download: https://www.oracle.com/technetwork/java/javase/downloads/index.html

  According to their own PC configuration and software applicable to select the appropriate version of the JDK

   This demonstration using   Java SE 8u221

  After downloading Ubuntu uploaded to the server, the directory can choose, I personally like to upload to the "/ opt" directory

  2. Download Tomcat

  Official Address : https://tomcat.apache.org/download-90.cgi

 

    Note: windows version Select the .zip compressed package, linux .tar.gz packaged versions of select packages

  Download Tomcat:

    The demo version of Tomcat using Tomcat 9

    Download completed

  To see if there is about two software

  Second, the installation configuration JDk

   1. Unzip JDk

   jdk package packaged by the tar, gzip compression, it is necessary to use the tar command to decompress, decompression path is very important to keep in mind certain this path, the default storage path to extract the current directory, if you change the extracted directory to be added after the command "-C extraction path "

 

   After the extraction is completed to see jdk1.8.0_221 directory that is successful decompression

   Linux install JDK compared with Windows, Linux without the need to install, simply to configure the environment variable back to

    2.JDK环境变量

  想使用JDK必须要配置以下几个环境变量:

    PATH:指定命令搜索目录

    CLASSPATH:指定类搜索目录,JVM就是通过CLASSPTH来寻找类的,我们只需要指定JDK目录中的dt.jar和tools.jar文件就可以了。

    JAVA_HOME:指定JAVA的家目录,也就是安装目录

  3.配置环境变量

   配置环境变量有很多种方法和方式:

    第一种:在当前shell下配置,但需要注意的是只在当前登入shell下可以使用

  方法:只需在命令行输入:

    

  export JAVA_PORT_HOME=/opt/jdk1.8.0_221/
  export PATH=$ JAVA_HOME/bin:$PATH 
  export CLASSPATH=.:$ JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 

 

 

 

  测试是否配置成功,只需检查版本即可

    java -version   //查看当前JDK版本

  可查询到版本即安装成功,出现如图样式的输出即安装成功

 

      第二种:修改/etc/profile文件(建议使用)

 

   方法:在/etc/prorile文件中添加下面变量,注意是添加不是覆盖,原文件内容本人不建议初学者修改,修改原文件会导致系统无法正常启动或部分功能无法使用

   

  export JAVA_PORT_HOME=/opt/jdk1.8.0_221/
  export PATH=$ JAVA_HOME/bin:$PATH 
  export CLASSPATH=.:$ JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 

 

 

 

      添加完成后需要执行一下变量,否则无法生效

  root@test:/opt# source /etc/profile    //执行变量

    然后进行测试即可

  三、部署Tomcat

  1.解压Tomcat软件包

  root@test:/opt# tar zxf apache-tomcat-9.0.26.tar.gz  //解压Tomcat软件包

  解压成功后会生成apache-tomcat-版本的一个文件

    进入解压目录

 

  在这里为大家简单介绍一下TomCat目录里面的这些目录:

    bin:bin目录主要是用来存放tomcat的命令,主要有两大类,一类是以.sh结尾的(linux命令),另一类是以.bat结尾的(windows命令)。

    conf:conf目录主要是用来存放tomcat的一些配置文件。

    lib:lib目录主要用来存放tomcat运行需要加载的jar包。

    logs:logs目录用来存放tomcat在运行过程中产生的日志文件。

    temp:temp目录用户存放tomcat在运行过程中产生的临时文件。

    webapps:webapps目录用来存放应用程序,当tomcat启动时会去加载webapps目录下的应用程序。

    work:work目录用来存放tomcat在运行时的编译后文件。

  2.启动Tomcat

    进入Tomcat目录中的bin目录,找到startup.sh执行即可

  root @ test: /opt/apache-tomcat-9.0.26/bin# ./startup.sh // start Tomcat

    Started successfully, view the process and access port

  root @ test: ~ # ps aux | grep tomcat // view the process started

  root @ test: ~ # netstat -anpt | grep 8080 // Check access port (default is 8080) Ruoyi Edit modify the command

    Access Tomcat, see this page indicates a successful deployment of tomcat

 

Guess you like

Origin www.cnblogs.com/kuiyajia/p/11670756.html