Installing Tomcat on Linux

0. Introduction

[ Tomcat ] : Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. (http://tomcat.apache.org/)

1. Environment

Ubuntu 10.04

JDK 1.6.0 u27

Apache Tomcat 7.0.22 (apache-tomcat-7.0.22.zip)

2. Steps

0) Install JDK (see http://www.cnblogs.com/chenyineng/archive/2011/10/04/2198951.html)

1) Extract apache-tomcat-7.0.22.zip to your program files folder, my instance is /home/yineng/program/apache-tomcat-7.0.22

2) Add environment variable
2.1) open /etc/environment file with command
$ sudo gedit /etc/environment
2.2) In the end of file, add following lines (/home/yineng/program is the folder where I installed the JDK and Tomcat, you should replace it with your direction)
PATH="/home/yineng/program/jdk1.6.0_27/bin"
JAVA_HOME="/home/yineng/program/jdk1.6.0_27"
JRE_HOME="/home/yineng/program/jdk1.6.0_27/jre"
CATALINA_HOME="/home/yineng/program/apache-tomcat-7.0.22"
2.3) You man need to restart your computer to apply the change

3) Change permissions (if you get the "./startup.sh: command not found" error when you try to start the Tomcat server)
$ chmod +x startup.sh
$ chmod +x catalina.sh
$ chmod +x shutdown.sh

4) Start tomcat server
$ ./home/yineng/program/apache-tomcat-7.0.22/bin/startup.sh

5) Check the installation result by visiting http://localhost:8080/

3. Reference

http://zhidao.baidu.com/question/145684921.html

原文地址:https://www.cnblogs.com/chenyineng/p/2200803.html