Ubuntu14.04安装tomcat-9.0.1的教程
系统环境:Ubuntu14.04
Tomcat安装版本:Apache tomcat 9.0.1
下载地址:http://tomcat.apache.org/download-90.cgi
安装包:apache-tomcat-9.0.1.tar.gz
解压tomcat 9.0.1, 移动解压后的文件到 /opt 目录
>>>开始配置tomcat
进入 /opt/apache-tomcat-9.0.1 目录
打开启动的脚本文件sudo gedit./bin/startup.sh
打开startup.sh文件后,添加jdk和jre
======================
JAVA8_HOME=/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin
export JAVA_HOME=$JAVA8_HOME
export PATH=$JAVA_HOME/bin:$PATH
export JRE_HOME=$JAVA_HOME/jre
export PATH=$JRE_HOME/bin:~/cts/android-sdk-linux/build-tools/19.1.0:$PATH
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
exec "$PRGDIR"/"$EXECUTABLE" start "$@"
===========================
JAVA_HOME和JRE_HOME 是已经配置好 JDK和JRE 目录, TOMCAT_HOME 为当前 apache-tomcat-9.0.1目录
在安装tomcat之前先要安装jdk和jre
>>>启动tomcat: sudo ./bin/startup.sh
验证tomcat配置和安装是否成功:在浏览器中输入:http://localhost:8080/
>>>关闭tomcat: sudo ./bin/shutdown.sh
在浏览器中输入: http://localhost:8080/ 一般打不开网页就是关闭成功了,
具体配置的环境变量如下所示:
root@suepc:/opt/apache-tomcat-9.0.1# echo $JAVA_HOME
/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin
root@suepc:/opt/apache-tomcat-9.0.1# echo $JRE_HOME
/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin/jre
root@suepc:/opt/apache-tomcat-9.0.1# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
root@suepc:/opt/apache-tomcat-9.0.1# echo $CLASSPATH
/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin/lib:/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin/jre/lib
JAVA_HOME=/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin
63 JRE_HOME=/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin/jre
64 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
65 #CLASSPATH=/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin/lib:/usr/lib/jvm/OpenJDK-1.8.0.112-x86_64-bin/jre/lib
66 TOMCAT_HOME=/opt/apache-tomcat-9.0.1