Tomcat 离线安装

Posted wx6144491ba79ae

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Tomcat 离线安装相关的知识,希望对你有一定的参考价值。

16.2 安装jdk

下载如下版本
\'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
root       1634  1.8  5.5 2998492 104000 pts/0  Sl   15:52   0: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
root       1684  0.0  0.0 112676   980 pts/0    S+   15:55   0: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
tcp6       0      0 :::8080                 :::*                    LISTEN      1634/java           
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      1634/java           
tcp6       0      0 :::8009                 :::*                    LISTEN      1634/java           

 

三个端口

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

以上是关于Tomcat 离线安装的主要内容,如果未能解决你的问题,请参考以下文章

Tomcat 离线安装

离线源码安装配置tomcat

案例:centos7 离线安装 tomcat8 单机 solr5

案例:centos7 离线安装 tomcat8 单机 solr5

Tomcat的安装教程

离线部署Tomcat