安装环境:
Ubuntu14.10
Tomcat:选用apache-tomcat-8.0.20.tar.gz
必须先安装JDK JRE
1、建立安装目录 解压
sudo mkdir –p /usr/local/tomcat
sudo tar –zxvf apache-tomcat-8.0.20.tar.gz /usr/local/tomcat/
cd /usr/local/tomcat/apache-tomcat-8.0.20
2、修改配置文件,增加java的环境变量信息。在/usr/local/apache-tomcat-8.0.20/bin下有文件catalina.sh在文件头部增加下列信息:
export JAVA_HOME=/usr/local/java/jdk1.8.0_40
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME
export CLASSPATH=.:$JRE_HOME/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export TOMCAT_HOME=/usr/local/tomcat/apache-tomcat-8.0.20
port="9090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
这里把8080改成了9090.浏览器输入http://localhost:9090即可。
3、在/usr/local/apache-tomcat-8.0.20/bin下有可执行程序。
启动tomcat服务:
sudo /usr/local/apache-tomcat-8.0.20/bin/startup.sh
sudo /usr/local/apache-tomcat-8.0.20/bin/catalina.sh start
关闭tomcat服务:
sudo /usr/local/apache-tomcat-8.0.20/bin/shutdown.sh
sudo /usr/local/apache-tomcat-8.0.20/bin/catalina.sh stop