Author: kkolinko Date: Fri Jun 8 19:17:26 2012 New Revision: 1348200 URL: http://svn.apache.org/viewvc?rev=1348200&view=rev Log: CTR: docs Improve RUNNING.txt: - Better describe environment variables. - Document setenv scripts. - Mention "catalina start"/"catalina stop" as well as "startup"/"shutdown" scripts. - Better document running with separate CATALINA_BASE and CATALINA_HOME. - Provide example of setenv files and example of using a context that points to ${catalina.home}. - Replace Netscape browser instructions with Firefox ones. - Add several references to User Guide and Configuration Reference. It is backport of r1196746 from Tomcat 7
Modified: tomcat/tc6.0.x/trunk/RUNNING.txt tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/RUNNING.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/RUNNING.txt?rev=1348200&r1=1348199&r2=1348200&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/RUNNING.txt (original) +++ tomcat/tc6.0.x/trunk/RUNNING.txt Fri Jun 8 19:17:26 2012 @@ -39,57 +39,125 @@ Running With JRE 5.0 Or Later the directory into which you installed the JRE, e.g. c:\jre5.0 or /usr/local/java/jre5.0. -NOTE: You may also use the full JDK rather than just the JRE. In this - case set your JAVA_HOME environment variable to the pathname of - the directory into which you installed the JDK, e.g. c:\j2sdk5.0 - or /usr/local/java/j2sdk5.0. + You may also use the full JDK rather than just the JRE. In this + case set you have to configure your environment variables + differently - see below. (2) Download and Install the Tomcat Binary Distribution -NOTE: As an alternative to downloading a binary distribution, you can create -your own from the Tomcat source repository, as described in "BUILDING.txt". -If you do this, the value to use for "${catalina.home}" will be the "dist" -subdirectory of your source distribution. - (2.1) Download a binary distribution of Tomcat from: - http://tomcat.apache.org + http://tomcat.apache.org/ (2.2) Unpack the binary distribution into a convenient location so that the distribution resides in its own directory (conventionally named - "apache-tomcat-[version]"). For the purposes of the remainder of this document, - the symbolic name "$CATALINA_HOME" is used to refer to the full - pathname of the release directory. + "apache-tomcat-[version]"). + + For the purposes of the remainder of this document, the name + "CATALINA_HOME" is used to refer to the full pathname of the release + directory. + +NOTE: As an alternative to downloading a binary distribution, you can +create your own from the Tomcat source code, as described in +"BUILDING.txt". You can either + + a) Do the full "release" build and find the created distributive in the + "output/release" directory and then proceed with unpacking as above, or + + b) Do a simple build and use the "output/build" directory as + "CATALINA_HOME". Be warned that there are some differences between + contents of "output/build" and the official "release" distributive. + + +(3) Configure Environment Variables + +Tomcat itself is a Java application and does not use environment variables, +but the startup scripts use them to prepare the command that starts Tomcat. +The full list of supported environment variables is provided as a comment +at the top of catalina.bat (Windows) and catalina.sh (Unix) files. + +(3.1) CATALINA_HOME and CATALINA_BASE + +The CATALINA_HOME and CATALINA_BASE environment variables are used to +specify location of Tomcat itself and of its active configuration +respectively. + +The CATALINA_HOME environment variable should be set as defined in (2.2) +above. The startup scripts have some logic to set this variable +automatically if it is absent (based on the location of the script in +Unixes and on the current directory in Windows), but it might be not +perfect. + +The CATALINA_BASE environment variable is optional and is further described +in "Multiple Tomcat Instances" section below. If it is not set it defaults +to be equal to CATALINA_HOME. +(3.2) JRE_HOME and other variables -(3) Start Up Tomcat +The third and the last environment variable that is needed to start Tomcat +specifies location of JRE or JDK that should be used to start Tomcat. -(3.1) Tomcat can be started by executing the following commands: +There are two different names of this variable, depending on whether JRE or +JDK is used. Use the JRE_HOME variable to specify location of a JRE and +JAVA_HOME variable to specify location of a JDK. - $CATALINA_HOME\bin\startup.bat (Windows) +All variables except CATALINA_HOME and CATALINA_BASE can be configured in a +setenv.bat (Windows) or setenv.sh (Unix) file. The setenv file can be either +in CATALINA_BASE/bin or in CATALINA_HOME/bin. If both are present, only the +one in CATALINA_BASE is used. + +So, either set JRE_HOME variable by yourselves or create the file. For +example, + +On Windows, %CATALINA_BASE%\bin\setenv.bat: + + set "JRE_HOME=%ProgramFiles%\Java\jre6" + exit /b 0 + +On Unix, $CATALINA_BASE/bin/setenv.sh: + + JRE_HOME=/usr/java/latest + + +(4) Start Up Tomcat + +(4.1) Tomcat can be started by executing one of the following commands: + + %CATALINA_HOME%\bin\startup.bat (Windows) $CATALINA_HOME/bin/startup.sh (Unix) -(3.2) After startup, the default web applications included with Tomcat will be + or + + %CATALINA_HOME%\bin\catalina.bat start (Windows) + + $CATALINA_HOME/bin/catalina.sh start (Unix) + +(4.2) After startup, the default web applications included with Tomcat will be available by visiting: http://localhost:8080/ -(3.3) Further information about configuring and running Tomcat can be found in +(4.3) Further information about configuring and running Tomcat can be found in the documentation included here, as well as on the Tomcat web site: - http://tomcat.apache.org + http://tomcat.apache.org/ -(4) Shut Down Tomcat +(5) Shut Down Tomcat -(4.1) Tomcat can be shut down by executing the following command: +(5.1) Tomcat can be shut down by executing one of the following commands: - $CATALINA_HOME\bin\shutdown (Windows) + %CATALINA_HOME%\bin\shutdown.bat (Windows) $CATALINA_HOME/bin/shutdown.sh (Unix) + or + + %CATALINA_HOME%\bin\catalina.bat stop (Windows) + + $CATALINA_HOME/bin/catalina.sh stop (Unix) ================================================== Advanced Configuration - Multiple Tomcat Instances @@ -97,33 +165,89 @@ Advanced Configuration - Multiple Tomcat In many circumstances, it is desirable to have a single copy of a Tomcat binary distribution shared among multiple users on the same server. To make -this possible, you can set the $CATALINA_BASE environment variable to the +this possible, you can set the CATALINA_BASE environment variable to the directory that contains the files for your 'personal' Tomcat instance. -When you use $CATALINA_BASE, Tomcat will calculate all relative references for -files in the following directories based on the value of $CATALINA_BASE instead -of $CATALINA_HOME: +When running with separate CATALINA_HOME and CATALINA_BASE, the files +and directories are split as following: + +In CATALINA_BASE: + + * bin - Only the following files: + + * setenv.sh (*nix) or setenv.bat (Windows), + * tomcat-juli.jar + + The setenv scripts were described above. The tomcat-juli library + is documented in the Logging chapter in the User Guide. + + * conf - Server configuration files (including server.xml) + + * lib - Libraries and classes + + * logs - Log and output files + + * webapps - Automatically loaded web applications + + * work - Temporary working directories for web applications + + * temp - Directory used by the JVM for temporary files (java.io.tmpdir) + + +In CATALINA_HOME: + + * bin - Startup and shutdown scripts + + The following files will be used only if they are absent in + CATALINA_BASE/bin: + + setenv.sh (*nix), setenv.bat (Windows), tomcat-juli.jar + + * lib - Libraries and classes, as explained below + + * endorsed - Libraries that override standard "Endorsed Standards" + libraries provided by JRE. See Classloading documentation + in the User Guide for details. + + By default this "endorsed" directory is absent. + +In the default configuration the JAR libraries and classes both in +CATALINA_BASE/lib and in CATALINA_HOME/lib will be added to the common +classpath, but the ones in CATALINA_BASE will be added first and thus will +be searched first. + +The idea is that you may leave the standard Tomcat libraries in +CATALINA_HOME/lib and add other ones such as database drivers into +CATALINA_BASE/lib. + +In general it is advised to never share libraries between web applications, +but put them into WEB-INF/lib directories inside the applications. See +Classloading documentation in the User Guide for details. -* bin - Only setenv.sh (*nix), setenv.bat (windows) and tomcat-juli.jar -* conf - Server configuration files (including server.xml) +It might be useful to note that the values of CATALINA_HOME and +CATALINA_BASE can be referenced in the XML configuration files processed +by Tomcat as ${catalina.home} and ${catalina.base} respectively. -* logs - Log and output files +For example, the standard manager web application can be kept in +CATALINA_HOME/webapps/manager and loaded into CATALINA_BASE by using +the following trick: -* webapps - Automatically loaded web applications + * Copy the CATALINA_HOME/webapps/manager/META-INF/context.xml + file as CATALINA_BASE/conf/Catalina/localhost/manager.xml -* work - Temporary working directories for web applications + * Add docBase attribute as shown below. -* temp - Directory used by the JVM for temporary files (java.io.tmpdir) +The file will look like the following: -Note that by default Tomcat will first try to load classes and JARs from -$CATALINA_BASE/lib and then $CATALINA_HOME/lib. You can place instance specific -JARs and classes (e.g. JDBC drivers) in $CATALINA_BASE/lib whilst keeping the -standard Tomcat JARs in $CATALINA_HOME/lib. + <?xml version="1.0" encoding="UTF-8"?> + <Context docBase="${catalina.home}/webapps/manager" + antiResourceLocking="false" privileged="true" useHttpOnly="true" > + </Context> -If you do not set $CATALINA_BASE, $CATALINA_BASE will default to the same value -as $CATALINA_HOME, which means that the same directory is used for all relative -path resolutions. +See Deployer chapter in User Guide and Context and Host chapters in the +Configuration Reference for more information on contexts and web +application deployment. ================ @@ -162,5 +286,6 @@ Tomcat install: browser knows that you shouldn't be going through the proxy to access the "localhost". - In Netscape, this is under Edit/Preferences -> Advanced/Proxies, and in - Internet Explorer, Tools -> Internet Options -> Connections -> LAN Settings. + In Firefox, this is under Tools/Preferences -> Advanced/Network -> + Connection -> Settings..., and in Internet Explorer it is Tools -> + Internet Options -> Connections -> LAN Settings. Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1348200&r1=1348199&r2=1348200&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Fri Jun 8 19:17:26 2012 @@ -257,6 +257,9 @@ by the Windows installer is <code>res/INSTALLLICENSE</code>. (kkolinko) </update> + <update> + Improve <code>RUNNING.txt</code>. (kkolinko) + </update> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org