Tomcat介绍及安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Tomcat介绍及安装相关的知识,希望对你有一定的参考价值。
Tomcat介绍
安装jdk
1.下载jdk包,并放到、usr/local/src目录下:
[[email protected] src]# ls
httpd-2.2.34 httpd-2.4.29.tar.gz
httpd-2.2.34.tar.gz jdk-8u161-linux-x64.tar.gz
httpd-2.4.29 mysql-5.6.36-linux-glibc2.5-x86_64.tar.g
2.进行解压:
[[email protected] src]# tar zxvf jdk-8u161-linux-x64.tar.gz
3.移动位置并改名:
[[email protected] src]# mv jdk1.8.0_161/ /usr/local/jdk1.8
4.编辑环境变量配置文件:
[[email protected] src]# vim /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
5.重置让变量生效:
[[email protected] src]# source /etc/profile
6.测试是否安装成功:
[[email protected] 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)
安装Tomcat
1.下载安装包:
[[email protected] src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.29/bin/apache-tomcat-8.5.29.tar.gz
2.解压缩:
[[email protected] src]# tar zxvf apache-tomcat-8.5.29.tar.gz
3.移动位置:
[[email protected] src]# mv apache-tomcat-8.5.29 /usr/local/tomcat
4.启动服务:
[[email protected] 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.
5.检查进程:
[[email protected] src]# ps aux |grep java
root 1388 17.9 8.3 2294712 83400 pts/0 Sl 16:53 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 1432 0.0 0.0 112676 980 pts/0 R+ 16:53 0:00 grep --color=auto java
6.关闭服务:不支持restart,要关闭再启动
[[email protected] 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
7.查看端口:8080,为web服务提供端口,8005为管理端口,8009为第三方调用端口
[[email protected] src]# netstat -lntp |grep java
tcp6 0 0 :::8080 :::* LISTEN 1475/java
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 1475/java
tcp6 0 0 :::8009 :::* LISTEN 1475/java
以上是关于Tomcat介绍及安装的主要内容,如果未能解决你的问题,请参考以下文章