Overview
Tomcat installation is very simple, and can be describes as "Unpack and Run". These instructions were written using Tomcat 6.0.14 but any recent 6.x version should work. If you are comfortable with the CLI, these the following quick instructions will get you going ASAP; otherwise skip to the OPENEJB:Download Tomcat section.
- Download Tomcat zip or tar.gz
- Unpack archive
- Platform specific setup
- [OPENEJB:Unix] If zip was unpacked,
chmod u+x bin/*.sh
- [OPENEJB:Windows]
set JAVA_HOME =C:\your\java\installation
- [OPENEJB:Unix] If zip was unpacked,
- Run bin/startup.sh or bin/startup.bat
- Visit http://localhost:8080/
- Run bin/shutdown.sh or bin/shutdown.bat
Download Tomcat
Download Tomcat 6 zip file from here.
Unpack Tomcat
Unpack the Tomcat zip file which will create a new directory containing the complete Tomcat installation.
C:\>jar -xvf apache-tomcat-6.0.14.zip created: apache-tomcat-6.0.14/ created: apache-tomcat-6.0.14/bin/ created: apache-tomcat-6.0.14/conf/ ...snip... C:\>dir apache-tomcat-6.0.14 Volume in drive C has no label. Volume Serial Number is 0000-0000 Directory of C:\apache-tomcat-6.0.14 09/20/2007 09:14 PM <DIR> . 09/20/2007 09:14 PM <DIR> .. 09/20/2007 09:15 PM <DIR> bin 09/20/2007 09:15 PM <DIR> conf 09/20/2007 09:15 PM <DIR> lib 07/20/2007 04:20 AM 11,560 LICENSE 09/20/2007 09:14 PM <DIR> logs 07/20/2007 04:20 AM 556 NOTICE 07/20/2007 04:20 AM 6,656 RELEASE-NOTES 07/20/2007 04:20 AM 5,829 RUNNING.txt 09/20/2007 09:14 PM <DIR> temp 09/20/2007 09:14 PM <DIR> webapps 09/20/2007 09:14 PM <DIR> work 4 File(s) 24,601 bytes 9 Dir(s) 5,085,085,696 bytes free
$ jar -xvf apache-tomcat-6.0.14.zip created: apache-tomcat-6.0.14/ created: apache-tomcat-6.0.14/bin/ created: apache-tomcat-6.0.14/conf/ ...snip... $ ls apache-tomcat-6.0.14/ LICENSE RELEASE-NOTES bin/ lib/ temp/ work/ NOTICE RUNNING.txt conf/ logs/ webapps/
[OPENEJB:Windows] Set JAVA_HOME environment variable
For Windows users, the Tomcat shell scripts must know the location of the Java installation, and this is done with environment variables. The following command will set the JAVA_HOME environment variable:
C:\>set JAVA_HOME =C:\your\java\installation
[OPENEJB:Unix] Make shell scripts executable
For Unix users, the shell scripts in the Tomcat installation are not executable by default, so in order to execute them, you must set mark them as executable. If you unpacked the Tomcat tar.gz file, the scripts are already executable. The following command will make all shell scripts executable:
apache-tomcat-6.0.14$ chmod u+x bin/*.sh
Start Tomcat
Execute the following command to start the Tomcat server:
C:\>cd apache-tomcat-6.0.14\bin C:\apache-tomcat-6.0.14\bin>startup.bat Using CATALINA_BASE: C:\apache-tomcat-6.0.14 Using CATALINA_HOME: C:\apache-tomcat-6.0.14 Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp Using JRE_HOME: C:\your\java\installation
$ cd apache-tomcat-6.0.14/bin apache-tomcat-6.0.14/bin$ ./startup.sh Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14 Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14 Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp Using JRE_HOME: /your/java/installation
NOTE: Your output will be different from the example above due to differences in installation location.
Verify Tomcat is Running
Visit http://localhost:8080/ and you should see the Tomcat welcome page.
Stop Tomcat
Shutdown Tomcat by executing the following command:
C:\apache-tomcat-6.0.14\bin>shutdown.bat Using CATALINA_BASE: C:\apache-tomcat-6.0.14 Using CATALINA_HOME: C:\apache-tomcat-6.0.14 Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp Using JRE_HOME: C:\your\java\installation
apache-tomcat-6.0.14/bin$ ./shutdown.sh Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14 Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14 Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp Using JRE_HOME: /your/java/installation
NOTE: Your output will be different from the example above due to differences in installation locations.