1.下载Apache Tomcat
2.安装
scp /Users/xxx/Downloads/apache-tomcat-8.5.31.tar.gz root@192.168.xx.xxx:/usr/local/src
[root@localhost src]# tar -zxvf apache-tomcat-8.5.31.tar.gz -C /usr/local
[root@localhost apache-tomcat-8.5.31]# /usr/local/apache-tomcat-8.5.31/bin/startup.sh
返回
Using CATALINA_BASE: /usr/local/apache-tomcat-8.5.31
Using CATALINA_HOME: /usr/local/apache-tomcat-8.5.31
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.31/temp
Using JRE_HOME: /usr/local/java/jdk-10.0.1
Using CLASSPATH: /usr/local/apache-tomcat-8.5.31/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.31/bin/tomcat-juli.jar
Tomcat started.
检查是否启动成功
[root@localhost apache-tomcat-8.5.31]# ps -ef | grep tomcat
开放端口8080
3.配置
vi /etc/profile
添加
#tomcat environment
export CATALINA_HOME=/usr/local/apache-tomcat-8.5.31
export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib:$CATALINA_HOME/lib
使修改生效
source /etc/profile
使Tomcat成为系统服务
[root@localhost ~]# cp /usr/local/apache-tomcat-8.5.31/bin/catalina.sh /etc/init.d/tomcat
[root@localhost ~]# vi /etc/init.d/tomcat
#!/bin/sh 下添加
# chkconfig: 2345 90 15
# description: Tomcat -en Manager
# ----------------------------------------------------------------------------- 下添加
JAVA_HOME=/usr/local/java/jdk-10.0.1
CATALINA_HOME=/usr/local/apache-tomcat-8.5.31
保存退出
[root@localhost ~]# chkconfig --add tomcat
[root@localhost ~]# service tomcat start
返回
Using CATALINA_BASE: /usr/local/apache-tomcat-8.5.31
Using CATALINA_HOME: /usr/local/apache-tomcat-8.5.31
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.31/temp
Using JRE_HOME: /usr/local/java/jdk-10.0.1/
Using CLASSPATH: /usr/local/apache-tomcat-8.5.31/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.31/bin/tomcat-juli.jar
Tomcat started.