1.Tomcat官网下载tar.gz包
2.通过ftp将tomcat8.5.23压缩包上传到ubuntu服务器
3.安装
- 解压
sudo tar -zxvf apache-tomcat-8.5.23.tar.gz
- 先在/usr下新建文件夹tomcat,然后将文件夹apache-tomcat-8.5.23移动到目录/usr/tomcat下
mv apache-tomcat-8.5.23 /usr/tomcat/
- 配置jdk环境
vim /usr/tomcat/apache-tomcat-8.5.23/bin/startup.sh
在最后一行之前加入如下信息:
#set java environment
export JAVA_HOME=/usr/java/jdk1.8.0_111
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:%{JAVA_HOME}/lib:%{JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
#tomcat
export TOMCAT_HOME=/usr/tomcat/apache-tomcat-8.5.23
- 然后运行 startup.sh 来开启Tomcat:
/usr/tomcat/apache-tomcat-8.5.23/bin/startup.sh
如下提示说明tomcat已开启:
Using CATALINA_BASE: /usr/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /usr/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /usr/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /usr/java/jdk1.8/jre
Using CLASSPATH: /usr/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
Tomcat started.
- 关闭Tomcat,
/usr/tomcat/apache-tomcat-8.5.23/bin/shutdown.sh