[66] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 6.0 - Tomcat Setup</title><meta value="Remy Maucherat" name="author"><meta value="remm@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt=" |
---|
| 2 | The Apache Tomcat Servlet/JSP Container |
---|
| 3 | " align="right" src="./../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="./../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Apache Tomcat 6.0</h1><h2>Tomcat Setup</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote> |
---|
| 4 | <p> |
---|
| 5 | This document introduces several ways to set up Tomcat for running |
---|
| 6 | on different platforms. Please note that some advanced setup issues |
---|
| 7 | are not covered here: the full distribution (ZIP file or tarball) |
---|
| 8 | includes a file called |
---|
| 9 | RUNNING.txt which discusses these issues. We encourage you to refer |
---|
| 10 | to it if the information below does not answer some of your questions. |
---|
| 11 | </p> |
---|
| 12 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Windows"><strong>Windows</strong></a></font></td></tr><tr><td><blockquote> |
---|
| 13 | |
---|
| 14 | <p> |
---|
| 15 | Installing Tomcat on Windows can be done easily using the Windows |
---|
| 16 | installer. Its interface and functionality is similar to other wizard |
---|
| 17 | based installers, with only a few items of interest. |
---|
| 18 | </p> |
---|
| 19 | |
---|
| 20 | <p> |
---|
| 21 | <ul> |
---|
| 22 | <li><strong>Installation as a service</strong>: Tomcat will be |
---|
| 23 | installed as a Windows |
---|
| 24 | NT/2k/XP service no matter what setting is selected. Using the |
---|
| 25 | checkbox on the component page sets the service as "auto" |
---|
| 26 | startup, so that Tomcat is automatically started when Windows |
---|
| 27 | starts. For optimal security, the service should be run as a |
---|
| 28 | separate user, with reduced permissions (see the Windows Services |
---|
| 29 | administration tool and its documentation).</li> |
---|
| 30 | <li><strong>Java location</strong>: The installer will use the registry |
---|
| 31 | or the JAVA_HOME environment variable to determine the base path |
---|
| 32 | of a J2SE 5 JRE. |
---|
| 33 | </li> |
---|
| 34 | <li><strong>Tray icon</strong>: When Tomcat is run as a service, there |
---|
| 35 | will not be any tray icon present when Tomcat is running. Note that |
---|
| 36 | when choosing to run Tomcat at the end of installation, the tray |
---|
| 37 | icon will be used even if Tomcat was installed as a service.</li> |
---|
| 38 | <li>Refer to the |
---|
| 39 | <a href="windows-service-howto.html">Windows Service HOW-TO</a> |
---|
| 40 | for information on how to manage Tomcat as Windows NT service. |
---|
| 41 | </li> |
---|
| 42 | </ul> |
---|
| 43 | </p> |
---|
| 44 | |
---|
| 45 | <p>The installer will create shortcuts allowing starting and configuring |
---|
| 46 | Tomcat. It is important to note that the Tomcat administration web |
---|
| 47 | application can only be used when Tomcat is running.</p> |
---|
| 48 | |
---|
| 49 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Unix daemon"><strong>Unix daemon</strong></a></font></td></tr><tr><td><blockquote> |
---|
| 50 | |
---|
| 51 | <p>Tomcat can be run as a daemon using the jsvc tool from the |
---|
| 52 | commons-daemon project. Source tarballs for jsvc are included with the |
---|
| 53 | Tomcat binaries, and need to be compiled. Building jsvc requires |
---|
| 54 | a C ANSI compiler (such as GCC), GNU Autoconf, and a JDK.</p> |
---|
| 55 | |
---|
| 56 | <p>Before running the script, the <code>JAVA_HOME</code> environment |
---|
| 57 | variable should be set to the base path of the JDK. Alternately, when |
---|
| 58 | calling the <code>./configure</code> script, the path of the JDK may |
---|
| 59 | be specified using the <code>--with-java</code> parameter, such as |
---|
| 60 | <code>./configure --with-java=/usr/java</code>.</p> |
---|
| 61 | |
---|
| 62 | <p>Using the following commands should result in a compiled jsvc binary, |
---|
| 63 | located in the <code>$CATALINA_HOME/bin</code> folder. This assumes |
---|
| 64 | that GNU TAR is used, and that <code>CATALINA_HOME</code> is an |
---|
| 65 | environment variable pointing to the base path of the Tomcat |
---|
| 66 | installation.</p> |
---|
| 67 | |
---|
| 68 | <p>Please note that you should use the GNU make (gmake) instead of |
---|
| 69 | the native BSD make on FreeBSD systems.</p> |
---|
| 70 | |
---|
| 71 | <p>Download a commons-daemon binary from the Jakarta Commons download page, |
---|
| 72 | and place jsvc.tar.gz and commons-daemon.jar in the |
---|
| 73 | <code>$CATALINA_HOME/bin</code> folder.</p> |
---|
| 74 | |
---|
| 75 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> |
---|
| 76 | cd $CATALINA_HOME/bin |
---|
| 77 | tar xvfz jsvc.tar.gz |
---|
| 78 | cd jsvc-src |
---|
| 79 | autoconf |
---|
| 80 | ./configure |
---|
| 81 | make |
---|
| 82 | cp jsvc .. |
---|
| 83 | cd .. |
---|
| 84 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div> |
---|
| 85 | |
---|
| 86 | <p>Tomcat can then be run as a daemon using the following commands.</p> |
---|
| 87 | |
---|
| 88 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> |
---|
| 89 | cd $CATALINA_HOME |
---|
| 90 | ./bin/jsvc -cp ./bin/bootstrap.jar \ |
---|
| 91 | -outfile ./logs/catalina.out -errfile ./logs/catalina.err \ |
---|
| 92 | org.apache.catalina.startup.Bootstrap |
---|
| 93 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div> |
---|
| 94 | |
---|
| 95 | <p>jsvc has other useful parameters, such as <code>-user</code> which |
---|
| 96 | causes it to switch to another user after the daemon initialization is |
---|
| 97 | complete. This allows, for example, running Tomcat as a non privileged |
---|
| 98 | user while still being able to use privileged ports. |
---|
| 99 | <code>jsvc --help</code> will return the full jsvc usage |
---|
| 100 | information. In particular, the <code>-debug</code> option is useful |
---|
| 101 | to debug issues running jsvc.</p> |
---|
| 102 | |
---|
| 103 | <p>The file <code>$CATALINA_HOME/bin/jsvc/native/tomcat.sh</code> can be |
---|
| 104 | used as a template for starting Tomcat automatically at boot time from |
---|
| 105 | <code>/etc/init.d</code>. The file is currently setup for running |
---|
| 106 | Tomcat 4.1.x, so it is necessary to edit it and change the classname |
---|
| 107 | from <code>BootstrapService</code> to <code>Bootstrap</code>.</p> |
---|
| 108 | |
---|
| 109 | <p>Note that the Commons-Daemon JAR file must be on your runtime classpath |
---|
| 110 | to run Tomcat in this manner. The Commons-Daemon JAR file is in the Class-Path |
---|
| 111 | entry of the bootstrap.jar manifest, but if you get a ClassNotFoundException |
---|
| 112 | or a NoClassDefFoundError for a Commons-Daemon class, add the Commons-Daemon |
---|
| 113 | JAR to the -cp argument when launching jsvc.</p> |
---|
| 114 | |
---|
| 115 | </blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em> |
---|
| 116 | Copyright © 1999-2008, Apache Software Foundation |
---|
| 117 | </em></font></div></td></tr></table></body></html> |
---|