Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
771 blopes 1
<!DOCTYPE html SYSTEM "about:legacy-compat">
2
<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="./images/docs-stylesheet.css" rel="stylesheet" type="text/css"><title>Apache Tomcat 9 (9.0.112) - Tomcat Setup</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="https://tomcat.apache.org/"><img alt="Tomcat Home" src="./images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="https://www.apache.org/" target="_blank"><img src="./images/asf-logo.svg" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>Apache Tomcat 9</h1><div class="versionInfo">
3
            Version 9.0.112,
4
            <time datetime="2025-11-06">Nov 6 2025</time></div><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2>Links</h2><ul><li><a href="index.html">Docs Home</a></li><li><a href="https://cwiki.apache.org/confluence/display/TOMCAT/FAQ">FAQ</a></li></ul></div><div><h2>User Guide</h2><ul><li><a href="introduction.html">1) Introduction</a></li><li><a href="setup.html">2) Setup</a></li><li><a href="appdev/index.html">3) First webapp</a></li><li><a href="deployer-howto.html">4) Deployer</a></li><li><a href="manager-howto.html">5) Manager</a></li><li><a href="host-manager-howto.html">6) Host Manager</a></li><li><a href="realm-howto.html">7) Realms and AAA</a></li><li><a href="security-manager-howto.html">8) Security Manager</a></li><li><a href="jndi-resources-howto.html">9) JNDI Resources</a></li><li><a href="jndi-datasource-examples-howto.html">10) JDBC DataSources</a></li><li><a href="class-loader-howto.html">11) Classloading</a></li><li><a href="jasper-howto.html">12) JSPs</a></li><li><a href="ssl-howto.html">13) SSL/TLS</a></li><li><a href="ssi-howto.html">14) SSI</a></li><li><a href="cgi-howto.html">15) CGI</a></li><li><a href="proxy-howto.html">16) Proxy Support</a></li><li><a href="mbeans-descriptors-howto.html">17) MBeans Descriptors</a></li><li><a href="default-servlet.html">18) Default Servlet</a></li><li><a href="cluster-howto.html">19) Clustering</a></li><li><a href="balancer-howto.html">20) Load Balancer</a></li><li><a href="connectors.html">21) Connectors</a></li><li><a href="monitoring.html">22) Monitoring and Management</a></li><li><a href="logging.html">23) Logging</a></li><li><a href="apr.html">24) APR/Native</a></li><li><a href="virtual-hosting-howto.html">25) Virtual Hosting</a></li><li><a href="aio.html">26) Advanced IO</a></li><li><a href="maven-jars.html">27) Mavenized</a></li><li><a href="security-howto.html">28) Security Considerations</a></li><li><a href="windows-service-howto.html">29) Windows Service</a></li><li><a href="windows-auth-howto.html">30) Windows Authentication</a></li><li><a href="jdbc-pool.html">31) Tomcat's JDBC Pool</a></li><li><a href="web-socket-howto.html">32) WebSocket</a></li><li><a href="rewrite.html">33) Rewrite</a></li><li><a href="cdi.html">34) CDI 2 and JAX-RS</a></li><li><a href="graal.html">35) AOT/GraalVM Support</a></li></ul></div><div><h2>Reference</h2><ul><li><a href="RELEASE-NOTES.txt">Release Notes</a></li><li><a href="config/index.html">Configuration</a></li><li><a href="api/index.html">Tomcat Javadocs</a></li><li><a href="servletapi/index.html">Servlet 4.0 Javadocs</a></li><li><a href="jspapi/index.html">JSP 2.3 Javadocs</a></li><li><a href="elapi/index.html">EL 3.0 Javadocs</a></li><li><a href="websocketapi/index.html">WebSocket 1.1 Javadocs</a></li><li><a href="jaspicapi/index.html">JASPIC 1.1 Javadocs</a></li><li><a href="annotationapi/index.html">Common Annotations 1.3 Javadocs</a></li><li><a href="https://tomcat.apache.org/connectors-doc/">JK 1.2 Documentation</a></li></ul></div><div><h2>Apache Tomcat Development</h2><ul><li><a href="building.html">Building</a></li><li><a href="changelog.html">Changelog</a></li><li><a href="https://cwiki.apache.org/confluence/display/TOMCAT/Tomcat+Versions">Status</a></li><li><a href="developers.html">Developers</a></li><li><a href="architecture/index.html">Architecture</a></li><li><a href="tribes/introduction.html">Tribes</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>Tomcat Setup</h2><h3 id="Table_of_Contents">Table of Contents</h3><div class="text">
5
<ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Windows">Windows</a></li><li><a href="#Unix_daemon">Unix daemon</a></li></ul>
6
</div><h3 id="Introduction">Introduction</h3><div class="text">
7
    <p>
8
      There are several ways to set up Tomcat for running on different
9
      platforms. The main documentation for this is a file called
10
      <a href="RUNNING.txt">RUNNING.txt</a>. We encourage you to refer to that
11
      file if the information below does not answer some of your questions.
12
    </p>
13
  </div><h3 id="Windows">Windows</h3><div class="text">
14
 
15
    <p>
16
      Installing Tomcat on Windows can be done easily using the Windows
17
      installer. Its interface and functionality is similar to other wizard
18
      based installers, with only a few items of interest.
19
    </p>
20
 
21
 
22
      <ul>
23
        <li><strong>Installation as a service</strong>: Tomcat will be
24
            installed as a Windows service no matter what setting is selected.
25
            Using the 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 provide a default
31
            JRE to use to run the service. The installer uses the registry to
32
            determine the base path of a Java 8 or later JRE,
33
            including the JRE installed as part of the full JDK. When running on
34
            a 64-bit operating system, the installer will first look for a
35
            64-bit JRE and only look for a 32-bit JRE if a 64-bit JRE is not
36
            found. If a JRE cannot be found when running on a 64-bit operating
37
            system, the installer will look for a 64-bit JDK. Finally, if a JRE
38
            or JDK has not been found, the installer will try to use the
39
            <code>JAVA_HOME</code> environment variable. It is not mandatory to
40
            use the default JRE detected by the installer. Any installed Java
41
            8 or later JRE (32-bit or 64-bit) may be
42
            used.</li>
43
        <li><strong>Tray icon</strong>: When Tomcat is run as a service, there
44
            will not be any tray icon present when Tomcat is running. Note that
45
            when choosing to run Tomcat at the end of installation, the tray
46
            icon will be used even if Tomcat was installed as a service.</li>
47
        <li><strong>Defaults</strong>: The defaults used by the installer may be
48
            overridden by use of the <code>/C=&lt;config file&gt;</code> command
49
            line argument. The configuration file uses the format
50
            <code>name=value</code> with each pair on a separate line. The names
51
            of the available configuration options are:
52
            <ul>
53
            <li>JavaHome</li>
54
            <li>TomcatPortShutdown</li>
55
            <li>TomcatPortHttp</li>
56
            <li>TomcatMenuEntriesEnable</li>
57
            <li>TomcatShortcutAllUsers</li>
58
            <li>TomcatServiceDefaultName</li>
59
            <li>TomcatServiceName</li>
60
            <li>TomcatServiceFileName</li>
61
            <li>TomcatServiceManagerFileName</li>
62
            <li>TomcatAdminEnable</li>
63
            <li>TomcatAdminUsername</li>
64
            <li>TomcatAdminPassword</li>
65
            <li>TomcatAdminRoles</li>
66
            </ul>
67
            By using <code>/C=...</code> along with <code>/S</code> and
68
            <code>/D=</code> it is possible to perform fully configured
69
            unattended installs of Apache Tomcat.
70
        </li>
71
        <li>Refer to the
72
            <a href="windows-service-howto.html">Windows Service How-To</a>
73
            for information on how to manage Tomcat as a Windows service.
74
            </li>
75
      </ul>
76
 
77
 
78
    <p>The installer will create shortcuts allowing starting and configuring
79
       Tomcat. It is important to note that the Tomcat administration web
80
       application can only be used when Tomcat is running.</p>
81
 
82
  </div><h3 id="Unix_daemon">Unix daemon</h3><div class="text">
83
 
84
    <p>Tomcat can be run as a daemon using the jsvc tool from the
85
       commons-daemon project. Source tarballs for jsvc are included with the
86
       Tomcat binaries, and need to be compiled. Building jsvc requires
87
       a C ANSI compiler (such as GCC), GNU Autoconf, and a JDK.</p>
88
 
89
    <p>Before running the script, the <code>JAVA_HOME</code> environment
90
       variable should be set to the base path of the JDK. Alternately, when
91
       calling the <code>./configure</code> script, the path of the JDK may
92
       be specified using the <code>--with-java</code> parameter, such as
93
       <code>./configure --with-java=/usr/java</code>.</p>
94
 
95
    <p>Using the following commands should result in a compiled jsvc binary,
96
       located in the <code>$CATALINA_HOME/bin</code> folder. This assumes
97
       that GNU TAR is used, and that <code>CATALINA_HOME</code> is an
98
       environment variable pointing to the base path of the Tomcat
99
       installation.</p>
100
 
101
    <p>Please note that you should use the GNU make (gmake) instead of
102
       the native BSD make on FreeBSD systems.</p>
103
 
104
<div class="codeBox"><pre><code>cd $CATALINA_HOME/bin
105
tar xvfz commons-daemon-native.tar.gz
106
cd commons-daemon-1.1.x-native-src/unix
107
./configure
108
make
109
cp jsvc ../..
110
cd ../..</code></pre></div>
111
 
112
    <p>Tomcat can then be run as a daemon using the following commands.</p>
113
 
114
<div class="codeBox"><pre><code>CATALINA_BASE=$CATALINA_HOME
115
cd $CATALINA_HOME
116
./bin/jsvc \
117
    -classpath $CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar \
118
    -outfile $CATALINA_BASE/logs/catalina.out \
119
    -errfile $CATALINA_BASE/logs/catalina.err \
120
    -Dcatalina.home=$CATALINA_HOME \
121
    -Dcatalina.base=$CATALINA_BASE \
122
    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
123
    -Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties \
124
    org.apache.catalina.startup.Bootstrap</code></pre></div>
125
 
126
    <p>When running on Java 9 you will need to additionally specify the
127
    following when starting jsvc.</p>
128
<div class="codeBox"><pre><code>...
129
--add-opens=java.base/java.lang=ALL-UNNAMED \
130
--add-opens=java.base/java.io=ALL-UNNAMED \
131
--add-opens=java.base/java.util=ALL-UNNAMED \
132
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED \
133
--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED \
134
...
135
</code></pre></div>
136
 
137
    <p>You may also need to specify <code>-jvm server</code> if the JVM defaults
138
       to using a server VM rather than a client VM. This has been observed on
139
       OSX.</p>
140
 
141
    <p>jsvc has other useful parameters, such as <code>-user</code> which
142
       causes it to switch to another user after the daemon initialization is
143
       complete. This allows, for example, running Tomcat as a non privileged
144
       user while still being able to use privileged ports. Note that if you
145
       use this option and start Tomcat as root, you'll need to disable the
146
       <code>org.apache.catalina.security.SecurityListener</code> check that
147
       prevents Tomcat starting when running as root.</p>
148
 
149
    <p><code>jsvc --help</code> will return the full jsvc usage
150
       information. In particular, the <code>-debug</code> option is useful
151
       to debug issues running jsvc.</p>
152
 
153
    <p>The file <code>$CATALINA_HOME/bin/daemon.sh</code> can be used as a
154
       template for starting Tomcat automatically at boot time from
155
       <code>/etc/init.d</code> with jsvc.</p>
156
 
157
    <p>Note that the Commons-Daemon JAR file must be on your runtime classpath
158
       to run Tomcat in this manner.  The Commons-Daemon JAR file is in the
159
       Class-Path entry of the bootstrap.jar manifest, but if you get a
160
       ClassNotFoundException or a NoClassDefFoundError for a Commons-Daemon
161
       class, add the Commons-Daemon JAR to the -cp argument when launching
162
       jsvc.</p>
163
 
164
  </div></div></div></div></div><footer><div id="footer">
165
    Copyright &copy; 1999-2025, The Apache Software Foundation
166
    <br>
167
    Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo
168
    are either registered trademarks or trademarks of the Apache Software
169
    Foundation.
170
    </div></footer></div></body></html>