Tomcat 离线安装

当筵意气临九霄,星离雨散不终朝。这篇文章主要讲述Tomcat 离线安装相关的知识,希望能为你提供帮助。
16.2 安装jdk

  • 在官网下载
    官网地址: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
下载如下版本
Tomcat 离线安装

文章图片

上传服务器
[root@taoyuan src]# ls
jdk-8u161-linux-x64.tar.gz
#解压
[root@taoyuan src]# tar zxvf jdk-8u161-linux-x64.tar.gz
#移动并修改目录名称
[root@taoyuan src]# mv jdk1.8.0_161/ /usr/local/jdk1.8

添加环境变量
[root@taoyuan src]# vi /etc/profile
#最后增加如下内容
java_HOME=/usr/local/jdk1.8/
JAVA_BIN=/usr/local/jdk1.8/bin
JRE_HOME=/usr/local/jdk1.8/jre
PATH=$PATH:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/jre/bin
CLASSPATH=/usr/local/jdk1.8/jre/lib:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib/charsets.jar
[root@taoyuan src]# source /etc/profile
#刷新

#验证
[root@taoyuan src]# java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
#当执行该命令,显示版本号,表示配置没有问题

16.3 安装Tomcat
#下载二进制软件包
[root@taoyun src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz
解压移动
[root@taoyun src]# tar zxvf apache-tomcat-8.5.24.tar.gz [root@taoyun src]# mv apache-tomcat-8.5.24 /usr/local/tomcat#启动 [root@taoyun src]# /usr/local/tomcat/bin/startup.sh Using CATALINA_BASE:/usr/local/tomcat Using CATALINA_HOME:/usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME:/usr/local/jdk1.8 Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started.#查看进程 [root@taoyun src]# ps aux |grep java root16341.85.5 2998492 104000 pts/0Sl15:520:04 /usr/local/jdk1.8/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dignore.endorsed.dirs= -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start root16840.00.0 112676980 pts/0S+15:550:00 grep --color=auto java#关闭Tomcat的命令 [root@taoyuan src]# /usr/local/tomcat/bin/shutdown.sh Using CATALINA_BASE:/usr/local/tomcat Using CATALINA_HOME:/usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME:/usr/local/jdk1.8 Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar


说明: Tomcat不支持restart,如果更改其配置文件,只能先关闭再启动。
[root@taoyun src]# netstat -lntp |grep java tcp600 :::8080:::*LISTEN1634/java tcp600 127.0.0.1:8005:::*LISTEN1634/java tcp600 :::8009:::*LISTEN1634/java


三个端口
【Tomcat 离线安装】端口8080:提供web服务的
端口8005:管理端口
端口8009:第三方服务调用端口(如:httpd和Tomcat结合时会用到)

    推荐阅读