在Linux上部署JavaEE应用

来源:互联网 发布:仿卷皮源码 编辑:程序博客网 时间:2024/06/08 00:20

前言

一般都是在阿里云或者其他云主机上来部署服务器,前端时间京东云免费送了一个一个月的主机,在这里写一篇记录一下吧!

使用XShell来连接主机发送命令:点击下载

使用FlashFXP来进行文件的传输:点击下载

1、在Linux安装东西是用yum命令最是简单,得到主机后不管其它先来一个update命令:

yum update

2、命令执行完毕,先看看是不是已经安装了JDK:yum list installed | grep java

[root@hzw-2312 ~]# yum list installed | grep javajava-1.7.0-openjdk.x86_64            1:1.7.0.121-2.6.8.1.el6_8         @updates java-1.7.0-openjdk-demo.x86_64       1:1.7.0.121-2.6.8.1.el6_8         @updates java-1.7.0-openjdk-devel.x86_64      1:1.7.0.121-2.6.8.1.el6_8         @updates java-1.7.0-openjdk-javadoc.noarch    1:1.7.0.121-2.6.8.1.el6_8         @updates java-1.7.0-openjdk-src.x86_64        1:1.7.0.121-2.6.8.1.el6_8         @updates tzdata-java.noarch                   2016j-1.el6                       @updates 

3、我这里之前已经安装了1.7的jdk,现在把它卸载了(如果没有,直接跳过此步骤):

卸载JDK输入:yum -y remove java-1.7.0-openjdk*
卸载tzdata-java输入:yum -y remove tzdata-java.noarch

[root@hzw-2312 ~]# yum -y remove java-1.7.0-openjdk*Loaded plugins: fastestmirror, prestoSetting up Remove ProcessResolving Dependencies--> Running transaction check---> Package java-1.7.0-openjdk.x86_64 1:1.7.0.121-2.6.8.1.el6_8 will be erased---> Package java-1.7.0-openjdk-demo.x86_64 1:1.7.0.121-2.6.8.1.el6_8 will be erased---> Package java-1.7.0-openjdk-devel.x86_64 1:1.7.0.121-2.6.8.1.el6_8 will be erased---> Package java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.121-2.6.8.1.el6_8 will be erased---> Package java-1.7.0-openjdk-src.x86_64 1:1.7.0.121-2.6.8.1.el6_8 will be erased--> Finished Dependency ResolutionDependencies Resolved======================================================================================== Package                       Arch      Version                      Repository   Size========================================================================================Removing: java-1.7.0-openjdk            x86_64    1:1.7.0.121-2.6.8.1.el6_8    @updates     91 M java-1.7.0-openjdk-demo       x86_64    1:1.7.0.121-2.6.8.1.el6_8    @updates    4.0 M java-1.7.0-openjdk-devel      x86_64    1:1.7.0.121-2.6.8.1.el6_8    @updates     36 M java-1.7.0-openjdk-javadoc    noarch    1:1.7.0.121-2.6.8.1.el6_8    @updates    233 M java-1.7.0-openjdk-src        x86_64    1:1.7.0.121-2.6.8.1.el6_8    @updates     43 MTransaction Summary========================================================================================Remove        5 Package(s)Installed size: 407 MDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Erasing    : 1:java-1.7.0-openjdk-src-1.7.0.121-2.6.8.1.el6_8.x86_64              1/5   Erasing    : 1:java-1.7.0-openjdk-javadoc-1.7.0.121-2.6.8.1.el6_8.noarch          2/5   Erasing    : 1:java-1.7.0-openjdk-devel-1.7.0.121-2.6.8.1.el6_8.x86_64            3/5   Erasing    : 1:java-1.7.0-openjdk-demo-1.7.0.121-2.6.8.1.el6_8.x86_64             4/5   Erasing    : 1:java-1.7.0-openjdk-1.7.0.121-2.6.8.1.el6_8.x86_64                  5/5   Verifying  : 1:java-1.7.0-openjdk-1.7.0.121-2.6.8.1.el6_8.x86_64                  1/5   Verifying  : 1:java-1.7.0-openjdk-src-1.7.0.121-2.6.8.1.el6_8.x86_64              2/5   Verifying  : 1:java-1.7.0-openjdk-javadoc-1.7.0.121-2.6.8.1.el6_8.noarch          3/5   Verifying  : 1:java-1.7.0-openjdk-demo-1.7.0.121-2.6.8.1.el6_8.x86_64             4/5   Verifying  : 1:java-1.7.0-openjdk-devel-1.7.0.121-2.6.8.1.el6_8.x86_64            5/5 Removed:  java-1.7.0-openjdk.x86_64 1:1.7.0.121-2.6.8.1.el6_8                                     java-1.7.0-openjdk-demo.x86_64 1:1.7.0.121-2.6.8.1.el6_8                                java-1.7.0-openjdk-devel.x86_64 1:1.7.0.121-2.6.8.1.el6_8                               java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.121-2.6.8.1.el6_8                             java-1.7.0-openjdk-src.x86_64 1:1.7.0.121-2.6.8.1.el6_8                               Complete![root@hzw-2312 ~]#
出现了Complete就说明JDK卸载成功了。
下面卸载tzdata-java:

[root@hzw-2312 ~]# yum -y remove tzdata-java.noarchLoaded plugins: fastestmirror, prestoSetting up Remove ProcessResolving Dependencies--> Running transaction check---> Package tzdata-java.noarch 0:2016j-1.el6 will be erased--> Finished Dependency ResolutionDependencies Resolved======================================================================================== Package               Arch             Version                Repository          Size========================================================================================Removing: tzdata-java           noarch           2016j-1.el6            @updates           362 kTransaction Summary========================================================================================Remove        1 Package(s)Installed size: 362 kDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Erasing    : tzdata-java-2016j-1.el6.noarch                                       1/1   Verifying  : tzdata-java-2016j-1.el6.noarch                                       1/1 Removed:  tzdata-java.noarch 0:2016j-1.el6                                                      Complete!
出现了Complete就说明tzdata-java卸载成功了。

4,、查看yum库中的Java安装包

输入:yum -y list java*

[root@hzw-2312 ~]# yum -y list java*Loaded plugins: fastestmirror, prestoLoading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.aliyun.comAvailable Packagesjava-1.5.0-gcj.x86_64                          1.5.0.0-29.1.el6                  base   java-1.5.0-gcj-devel.x86_64                    1.5.0.0-29.1.el6                  base   java-1.5.0-gcj-javadoc.x86_64                  1.5.0.0-29.1.el6                  base   java-1.5.0-gcj-src.x86_64                      1.5.0.0-29.1.el6                  base   java-1.6.0-openjdk.x86_64                      1:1.6.0.40-1.13.12.6.el6_8        updatesjava-1.6.0-openjdk-demo.x86_64                 1:1.6.0.40-1.13.12.6.el6_8        updatesjava-1.6.0-openjdk-devel.x86_64                1:1.6.0.40-1.13.12.6.el6_8        updatesjava-1.6.0-openjdk-javadoc.x86_64              1:1.6.0.40-1.13.12.6.el6_8        updatesjava-1.6.0-openjdk-src.x86_64                  1:1.6.0.40-1.13.12.6.el6_8        updatesjava-1.7.0-openjdk.x86_64                      1:1.7.0.121-2.6.8.1.el6_8         updatesjava-1.7.0-openjdk-demo.x86_64                 1:1.7.0.121-2.6.8.1.el6_8         updatesjava-1.7.0-openjdk-devel.x86_64                1:1.7.0.121-2.6.8.1.el6_8         updatesjava-1.7.0-openjdk-javadoc.noarch              1:1.7.0.121-2.6.8.1.el6_8         updatesjava-1.7.0-openjdk-src.x86_64                  1:1.7.0.121-2.6.8.1.el6_8         updatesjava-1.8.0-openjdk.x86_64                      1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-debug.x86_64                1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-demo.x86_64                 1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-demo-debug.x86_64           1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-devel.x86_64                1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-devel-debug.x86_64          1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-headless.x86_64             1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-headless-debug.x86_64       1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-javadoc.noarch              1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-javadoc-debug.noarch        1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-src.x86_64                  1:1.8.0.111-0.b15.el6_8           updatesjava-1.8.0-openjdk-src-debug.x86_64            1:1.8.0.111-0.b15.el6_8           updatesjava-dirq.noarch                               1.4-1.el6                         epel   java-dirq-javadoc.noarch                       1.4-1.el6                         epel   java-service-wrapper.x86_64                    3.2.5-23.el6                      epel   java-service-wrapper-javadoc.noarch            3.2.5-23.el6                      epel   java-sleep.noarch                              2.1-6.el6                         epel   java-sleep-javadoc.noarch                      2.1-6.el6                         epel   java_cup.x86_64                                1:0.10k-5.el6                     base   java_cup-javadoc.x86_64                        1:0.10k-5.el6                     base   java_cup-manual.x86_64                         1:0.10k-5.el6                     base   javacc.x86_64                                  4.1-0.5.el6                       base   javacc-demo.x86_64                             4.1-0.5.el6                       base   javacc-manual.x86_64                           4.1-0.5.el6                       base   javassist.noarch                               3.9.0-6.el6                       base   javassist-javadoc.noarch                       3.9.0-6.el6                       base   javastroke.x86_64                              0.5.1-33.el6                      epel   javatar.noarch                                 2.5-5.el6                         epel   javatar-javadoc.noarch                         2.5-5.el6                         epel   [root@hzw-2312 ~]# 

5、使用yum命令安装Java环境

输入:yum -y install java-1.8.0-openjdk*

[root@hzw-2312 ~]# yum -y install java-1.8.0-openjdk*Loaded plugins: fastestmirror, prestoSetting up Install ProcessLoading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.aliyun.comResolving Dependencies--> Running transaction check---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-debug.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-demo.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed--> Processing Dependency: tzdata-java >= 2014f-1 for package: 1:java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64---> Package java-1.8.0-openjdk-headless-debug.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-src.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed---> Package java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.111-0.b15.el6_8 will be installed--> Running transaction check---> Package tzdata-java.noarch 0:2016j-1.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved======================================================================================== Package                             Arch     Version                   Repository                                                                                   Size========================================================================================Installing: java-1.8.0-openjdk                  x86_64   1:1.8.0.111-0.b15.el6_8   updates   198 k java-1.8.0-openjdk-debug            x86_64   1:1.8.0.111-0.b15.el6_8   updates   201 k java-1.8.0-openjdk-demo             x86_64   1:1.8.0.111-0.b15.el6_8   updates   1.9 M java-1.8.0-openjdk-demo-debug       x86_64   1:1.8.0.111-0.b15.el6_8   updates   2.0 M java-1.8.0-openjdk-devel            x86_64   1:1.8.0.111-0.b15.el6_8   updates    10 M java-1.8.0-openjdk-devel-debug      x86_64   1:1.8.0.111-0.b15.el6_8   updates    10 M java-1.8.0-openjdk-headless         x86_64   1:1.8.0.111-0.b15.el6_8   updates    32 M java-1.8.0-openjdk-headless-debug   x86_64   1:1.8.0.111-0.b15.el6_8   updates    32 M java-1.8.0-openjdk-javadoc          noarch   1:1.8.0.111-0.b15.el6_8   updates    17 M java-1.8.0-openjdk-javadoc-debug    noarch   1:1.8.0.111-0.b15.el6_8   updates    17 M java-1.8.0-openjdk-src              x86_64   1:1.8.0.111-0.b15.el6_8   updates    45 M java-1.8.0-openjdk-src-debug        x86_64   1:1.8.0.111-0.b15.el6_8   updates    45 MInstalling for dependencies: tzdata-java                         noarch   2016j-1.el6               updates   182 kTransaction Summary========================================================================================Install      13 Package(s)Total download size: 214 MInstalled size: 939 MDownloading Packages:Setting up and reading Presto delta metadataupdates/prestodelta                                              | 275 kB     00:00     Processing delta metadataPackage(s) data still to download: 214 M(1/13): java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64.rpm      | 198 kB     00:00     (2/13): java-1.8.0-openjdk-debug-1.8.0.111-0.b15.el6_8.x86_64.rp | 201 kB     00:00     (3/13): java-1.8.0-openjdk-demo-1.8.0.111-0.b15.el6_8.x86_64.rpm | 1.9 MB     00:01     (4/13): java-1.8.0-openjdk-demo-debug-1.8.0.111-0.b15.el6_8.x86_ | 2.0 MB     00:01     (5/13): java-1.8.0-openjdk-devel-1.8.0.111-0.b15.el6_8.x86_64.rp |  10 MB     00:10     (6/13): java-1.8.0-openjdk-devel-debug-1.8.0.111-0.b15.el6_8.x86_64.rpm                                                                                                                                                                                |  10 MB     00:09     (7/13): java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64.rpm                                                                                                                                                                                   |  32 MB     00:31     (8/13): java-1.8.0-openjdk-headless-debug-1.8.0.111-0.b15.el6_8.x86_64.rpm                                                                                                                                                                             |  32 MB     00:32     (9/13): java-1.8.0-openjdk-javadoc-1.8.0.111-0.b15.el6_8.noarch.rpm                                                                                                                                                                                    |  17 MB     00:17     (10/13): java-1.8.0-openjdk-javadoc-debug-1.8.0.111-0.b15.el6_8.noarch.rpm                                                                                                                                                                             |  17 MB     00:17     (11/13): java-1.8.0-openjdk-src-1.8.0.111-0.b15.el6_8.x86_64.rpm                                                                                                                                                                                       |  45 MB     00:45     (12/13): java-1.8.0-openjdk-src-debug-1.8.0.111-0.b15.el6_8.x86_64.rpm                                                                                                                                                                                 |  45 MB     00:44     (13/13): tzdata-java-2016j-1.el6.noarch.rpm                                                                                                                                                                                                            | 182 kB     00:00     ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                                                                                                         1.0 MB/s | 214 MB     03:34     Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Installing : tzdata-java-2016j-1.el6.noarch                                                                                                                                                                                                                            1/13   Installing : 1:java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                2/13   Installing : 1:java-1.8.0-openjdk-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                   3/13   Installing : 1:java-1.8.0-openjdk-devel-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                             4/13   Installing : 1:java-1.8.0-openjdk-headless-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                          5/13   Installing : 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                         6/13   Installing : 1:java-1.8.0-openjdk-demo-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                    7/13   Installing : 1:java-1.8.0-openjdk-devel-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                   8/13   Installing : 1:java-1.8.0-openjdk-src-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                               9/13   Installing : 1:java-1.8.0-openjdk-demo-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                             10/13   Installing : 1:java-1.8.0-openjdk-src-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                    11/13   Installing : 1:java-1.8.0-openjdk-javadoc-1.8.0.111-0.b15.el6_8.noarch                                                                                                                                                                                                12/13   Installing : 1:java-1.8.0-openjdk-javadoc-debug-1.8.0.111-0.b15.el6_8.noarch                                                                                                                                                                                          13/13   Verifying  : 1:java-1.8.0-openjdk-devel-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                             1/13   Verifying  : 1:java-1.8.0-openjdk-headless-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                2/13   Verifying  : 1:java-1.8.0-openjdk-javadoc-debug-1.8.0.111-0.b15.el6_8.noarch                                                                                                                                                                                           3/13   Verifying  : 1:java-1.8.0-openjdk-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                   4/13   Verifying  : 1:java-1.8.0-openjdk-src-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                               5/13   Verifying  : 1:java-1.8.0-openjdk-headless-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                          6/13   Verifying  : 1:java-1.8.0-openjdk-src-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                     7/13   Verifying  : 1:java-1.8.0-openjdk-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                         8/13   Verifying  : 1:java-1.8.0-openjdk-demo-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                    9/13   Verifying  : 1:java-1.8.0-openjdk-javadoc-1.8.0.111-0.b15.el6_8.noarch                                                                                                                                                                                                10/13   Verifying  : 1:java-1.8.0-openjdk-devel-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                                  11/13   Verifying  : 1:java-1.8.0-openjdk-demo-debug-1.8.0.111-0.b15.el6_8.x86_64                                                                                                                                                                                             12/13   Verifying  : tzdata-java-2016j-1.el6.noarch                                                                                                                                                                                                                           13/13 Installed:  java-1.8.0-openjdk.x86_64 1:1.8.0.111-0.b15.el6_8              java-1.8.0-openjdk-debug.x86_64 1:1.8.0.111-0.b15.el6_8              java-1.8.0-openjdk-demo.x86_64 1:1.8.0.111-0.b15.el6_8          java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.111-0.b15.el6_8           java-1.8.0-openjdk-devel.x86_64 1:1.8.0.111-0.b15.el6_8        java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.111-0.b15.el6_8        java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-0.b15.el6_8      java-1.8.0-openjdk-headless-debug.x86_64 1:1.8.0.111-0.b15.el6_8       java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.111-0.b15.el6_8      java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.111-0.b15.el6_8      java-1.8.0-openjdk-src.x86_64 1:1.8.0.111-0.b15.el6_8           java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.111-0.b15.el6_8          Dependency Installed:  tzdata-java.noarch 0:2016j-1.el6                                                                                                                                                                                                                                            Complete!
出现Complete后,jdk就安装成功了!

6、测试jdk

输入:java
[root@hzw-2312 ~]# javaUsage: java [-options] class [args...]           (to execute a class)   or  java [-options] -jar jarfile [args...]           (to execute a jar file)where options include:    -d32  use a 32-bit data model if available    -d64  use a 64-bit data model if available    -server  to select the "server" VM                  The default VM is server.    -cp <class search path of directories and zip/jar files>    -classpath <class search path of directories and zip/jar files>                  A : separated list of directories, JAR archives,                  and ZIP archives to search for class files.    -D<name>=<value>                  set a system property    -verbose:[class|gc|jni]                  enable verbose output    -version      print product version and exit    -version:<value>                  Warning: this feature is deprecated and will be removed                  in a future release.                  require the specified version to run    -showversion  print product version and continue    -jre-restrict-search | -no-jre-restrict-search                  Warning: this feature is deprecated and will be removed                  in a future release.                  include/exclude user private JREs in the version search    -? -help      print this help message    -X            print help on non-standard options    -ea[:<packagename>...|:<classname>]    -enableassertions[:<packagename>...|:<classname>]                  enable assertions with specified granularity    -da[:<packagename>...|:<classname>]    -disableassertions[:<packagename>...|:<classname>]                  disable assertions with specified granularity    -esa | -enablesystemassertions                  enable system assertions    -dsa | -disablesystemassertions                  disable system assertions    -agentlib:<libname>[=<options>]                  load native agent library <libname>, e.g. -agentlib:hprof                  see also, -agentlib:jdwp=help and -agentlib:hprof=help    -agentpath:<pathname>[=<options>]                  load native agent library by full pathname    -javaagent:<jarpath>[=<options>]                  load Java programming language agent, see java.lang.instrument    -splash:<imagepath>                  show splash screen with specified imageSee http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
输入:javac

系统能识别两个命令说明我们的安装就成功了。

[root@hzw-2312 ~]# javacUsage: javac <options> <source files>where possible options include:  -g                         Generate all debugging info  -g:none                    Generate no debugging info  -g:{lines,vars,source}     Generate only some debugging info  -nowarn                    Generate no warnings  -verbose                   Output messages about what the compiler is doing  -deprecation               Output source locations where deprecated APIs are used  -classpath <path>          Specify where to find user class files and annotation processors  -cp <path>                 Specify where to find user class files and annotation processors  -sourcepath <path>         Specify where to find input source files  -bootclasspath <path>      Override location of bootstrap class files  -extdirs <dirs>            Override location of installed extensions  -endorseddirs <dirs>       Override location of endorsed standards path  -proc:{none,only}          Control whether annotation processing and/or compilation is done.  -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process  -processorpath <path>      Specify where to find annotation processors  -parameters                Generate metadata for reflection on method parameters  -d <directory>             Specify where to place generated class files  -s <directory>             Specify where to place generated source files  -h <directory>             Specify where to place generated native header files  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files  -encoding <encoding>       Specify character encoding used by source files  -source <release>          Provide source compatibility with specified release  -target <release>          Generate class files for specific VM version  -profile <profile>         Check that API used is available in the specified profile  -version                   Version information  -help                      Print a synopsis of standard options  -Akey[=value]              Options to pass to annotation processors  -X                         Print a synopsis of nonstandard options  -J<flag>                   Pass <flag> directly to the runtime system  -Werror                    Terminate compilation if warnings occur  @<filename>                Read options and filenames from file

7、Tomcat安装

这里我们不选择安装Tomcat直接在官网下载一个绿色版本的Tomcat来就好:Tomcat官网

下载好过后我们直接使用FlashFXP来把Tomcat传输到Linux主机上:

a、安装好过后,点击左上角的“会话E”选择“快速连接”。
b、连接类型选择“SFTP over SSH”
c、输入地址或URL:这里填写主机的IP地址,端口就用默认的22
d、填写用户名跟密码
e、其他就不用管了,直接点击“连接”

f、安装unzip来进行zip包的解压缩:

输入:yum install unzip

[root@hzw-2312 ~]# yum install unzipLoaded plugins: fastestmirror, prestoSetting up Install ProcessLoading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.aliyun.comResolving Dependencies--> Running transaction check---> Package unzip.x86_64 0:6.0-4.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved======================================================================================== Package            Arch                Version                 Repository         Size========================================================================================Installing: unzip              x86_64              6.0-4.el6               base              152 kTransaction Summary========================================================================================Install       1 Package(s)Total download size: 152 kInstalled size: 324 kIs this ok [y/N]: yDownloading Packages:Setting up and reading Presto delta metadataProcessing delta metadataPackage(s) data still to download: 152 kunzip-6.0-4.el6.x86_64.rpm                                       | 152 kB     00:00     Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Installing : unzip-6.0-4.el6.x86_64                                               1/1   Verifying  : unzip-6.0-4.el6.x86_64                                               1/1 Installed:  unzip.x86_64 0:6.0-4.el6                                                              Complete!
安装成功后,使用unzip命令来解压缩Tomcat的.zip包,当然你也可以在Windows解压好了直接传到主机上

先进入Linux主机上Tomcat的存放目录下面,在使用unzip命令解压Tomcat压缩文件

[root@hzw-2312 ~]# cd /home/web/[root@hzw-2312 web]# lsapache-tomcat-7.0.68  apache-tomcat-9.0.0.M8.zip[root@hzw-2312 web]# unzip apache-tomcat-9.0.0.M8.zip

8、启动Tomcat

解压好过后进入Tomcat的bin目录下面输入:./startup.sh

[root@hzw-2312 web]# cd /home/web/apache-tomcat-9.0.0.M8/bin[root@hzw-2312 bin]# ./startup.sh-bash: ./startup.sh: Permission denied[root@hzw-2312 bin]# 
这是提示我们没有执行.sh文件的权限,我们得在当前bin目录执行允许运行.sh文件的命令,输入:chmod u+x *.sh

获得执行权限后在输入:./startup.sh

[root@hzw-2312 bin]# chmod u+x *.sh[root@hzw-2312 bin]# ./startup.sh Using CATALINA_BASE:   /home/web/apache-tomcat-9.0.0.M8Using CATALINA_HOME:   /home/web/apache-tomcat-9.0.0.M8Using CATALINA_TMPDIR: /home/web/apache-tomcat-9.0.0.M8/tempUsing JRE_HOME:        /usrUsing CLASSPATH:       /home/web/apache-tomcat-9.0.0.M8/bin/bootstrap.jar:/home/web/apache-tomcat-9.0.0.M8/bin/tomcat-juli.jarTomcat started.
这样我们的Tomcat就启动了,如果需要差可拟Tomcat的控制台,需要在logs目录下执行:tail -f catalina.out

[root@hzw-2312 bin]# cd ../logs[root@hzw-2312 logs]# tail -f catalina.out05-Dec-2016 11:11:48.717 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/web/apache-tomcat-9.0.0.M8/temp05-Dec-2016 11:11:48.717 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib05-Dec-2016 11:11:48.822 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]05-Dec-2016 11:11:48.849 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read05-Dec-2016 11:11:48.858 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]05-Dec-2016 11:11:48.860 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read05-Dec-2016 11:11:48.860 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 753 ms05-Dec-2016 11:11:48.896 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina05-Dec-2016 11:11:48.896 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.0.M805-Dec-2016 11:11:48.914 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/ROOT05-Dec-2016 11:12:17.240 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [27,715] milliseconds.05-Dec-2016 11:12:17.286 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/ROOT has finished in 28,372 ms05-Dec-2016 11:12:17.286 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/docs05-Dec-2016 11:12:17.333 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/docs has finished in 47 ms05-Dec-2016 11:12:17.333 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/manager05-Dec-2016 11:12:17.405 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/manager has finished in 72 ms05-Dec-2016 11:12:17.406 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/host-manager05-Dec-2016 11:12:17.440 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/host-manager has finished in 35 ms05-Dec-2016 11:12:17.442 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/examples05-Dec-2016 11:12:17.819 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/web/apache-tomcat-9.0.0.M8/webapps/examples has finished in 377 ms05-Dec-2016 11:12:17.824 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [http-nio-8080]05-Dec-2016 11:12:17.841 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [ajp-nio-8009]05-Dec-2016 11:12:17.845 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 28984 ms

9、测试Tomcat安装是否成功

在浏览器中输入我们的ip地址加上端口号:http://120.132.115.246:8080/






------------------------------------------------------------------------------------------------------

如果需要80端口,可以考虑直接把程序放在Root目录下,把原来的Root目录的文件全部删除,配置conf目录下的server.xml文件的端口为80就好。

还可以直接在server.xml中的Host节点中配置编译好了的工程代码:

<Host name="localhost"  appBase="webapps"unpackWARs="true" autoDeploy="true"><Context path="/" docBase="/home/web/代码目录"debug="0" reloadable="false" URIEncoding="UTF-8"></Context><Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"   prefix="localhost_access_log." suffix=".txt"   pattern="%h %l %u %t "%r" %s %b" /></Host>









0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 宝宝头着地摔了怎么办 小孩头着地摔了怎么办 头朝下墩了脖子怎么办 两岁摔倒头着地怎么办 马桶大便冲不下去怎么办 脚丫吧里起泡痒怎么办 脚受伤后肿了怎么办 摔到了腿受伤了怎么办 骑车摔倒了肿了怎么办 生活大冒险老婆失踪了怎么办 手机qq图裂了怎么办 qq发的图裂了怎么办 抖音账号搬运多怎么办 别人搜不到我QQ怎么办 qq号被限制解封怎么办 买的桌子会晃怎么办 车子座椅皮坏了怎么办 裤子被椅子刮了怎么办 脚麻了被别人动怎么办 毛孔又粗又黑怎么办 手臂睡觉压麻了怎么办 睡觉压的胳膊麻怎么办 摔跤摔到腰肿了怎么办 牛奶喝多了拉稀怎么办 doc文档下载是乱码怎么办 家人被教练技术骗了怎么办 十个月宝宝不爱喝水怎么办 离婚后孩子找爸爸怎么办 离婚后孩子要找爸爸怎么办 断奶期间胸涨的难受怎么办 断奶胸涨的很疼怎么办 过了麦季身上老痒怎么办 过麦时候皮肤痒怎么办 颈部起红疙瘩痒怎么办 脚底痒身上痒该怎么办 生完孩子屁股疼怎么办 pr打开工程文件无响应怎么办 娃娃和老师有隔阂了怎么办 大人字写得不好怎么办 不会写好看的字怎么办 无限量流量限速了怎么办