Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Dashboard
Maven User
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<h1>Introduction</h1> <p>In order to Run Tomcat as a linux service, you should follow these steps:</p> <ol> <li><a class="confluence-link" href="#Install the wrapper service" data-anchor="Install the wrapper service" data-linked-resource-default-alias="Install the wrapper service" data-base-url="http://docs.codehaus.org">#Install the wrapper service</a></li> <li><a class="confluence-link" href="#Create a tomcat environment definition script" data-anchor="Create a tomcat environment definition script" data-linked-resource-default-alias="Create a tomcat environment definition script" data-base-url="http://docs.codehaus.org">#Create a tomcat environment definition script</a></li> <li><a class="confluence-link" href="#Create a tomcat launcher script" data-anchor="Create a tomcat launcher script" data-linked-resource-default-alias="Create a tomcat launcher script" data-base-url="http://docs.codehaus.org">#Create a tomcat launcher script</a></li> <li><a class="confluence-link" href="#Configure the wrapper service to run tomcat" data-anchor="Configure the wrapper service to run tomcat" data-linked-resource-default-alias="Configure the wrapper service to run tomcat" data-base-url="http://docs.codehaus.org">#Configure the wrapper service to run tomcat</a></li> <li><a class="confluence-link" href="#Link the tomcat launcher script to the init scripts directory" data-anchor="Link the tomcat launcher script to the init scripts directory" data-linked-resource-default-alias="Link the tomcat launcher script to the init scripts directory" data-base-url="http://docs.codehaus.org">#Link the tomcat launcher script to the init scripts directory</a></li> <li><a class="confluence-link" href="#Link the tomcat init script to the revelant init levels" data-anchor="Link the tomcat init script to the revelant init levels" data-linked-resource-default-alias="Link the tomcat init script to the revelant init levels" data-base-url="http://docs.codehaus.org">#Link the tomcat init script to the revelant init levels</a></li> </ol> <h1>Install the wrapper service<img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2FuY2hvcjpJbnN0YWxsIHRoZSB3cmFwcGVyIHNlcnZpY2V9&locale=en_GB&version=2" data-macro-name="anchor" data-macro-default-parameter="Install the wrapper service"></h1> <p>Download the wrapper service binaries for Linux (<a href="http://wrapper.tanukisoftware.org">http://wrapper.tanukisoftware.org</a>)</p> <p>Copy the binaries as defined in (<a href="http://wrapper.tanukisoftware.org/doc/english/integrate-simple-nix.html">http://wrapper.tanukisoftware.org/doc/english/integrate-simple-nix.html</a>):</p> <ul> <li>copy the <code>wrapper</code> file in the <code>$(tomcat.home)/bin</code> directory,</li> <li>copy the <code>sh.script.in file in the {{$(tomcat.home)/bin</code> directory and rename it to tomcat,</li> <li>copy the <code>wrapper.jar</code> file in the <code>$(tomcat.home)/common/lib</code> directory.</li> </ul> <p>Edit the newly renamed <code>tomcat</code> file to ensure the following lines are defined.</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> APP_NAME="tomcat" APP_LONG_NAME="Tomcat Application Server" </pre></td></tr></table> <p>Change the permisions of that file : chmod ug+x $(tomcat.home)/bin/tomcat)</p> <h1>Create a tomcat environment definition script<img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2FuY2hvcjpDcmVhdGUgYSB0b21jYXQgZW52aXJvbm1lbnQgZGVmaW5pdGlvbiBzY3JpcHR9&locale=en_GB&version=2" data-macro-name="anchor" data-macro-default-parameter="Create a tomcat environment definition script"></h1> <p>Create the <code>$(server.home)/tomcat.env</code> file with the following content (dont forget to expand the <code>$(xxx)</code> variables with your defined values)</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> CATALINA_HOME=$(tomcat.home) CATALINA_BASE=$(server.tomcat.home) export CATALINA_HOME CATALINA_BASE JAVA_HOME=$(java.home) export JAVA_HOME M2_HOME=$(m2.home) export M2_HOME PATH=$M2_HOME/bin:$CATALINA_HOME/bin:$JAVA_HOME/bin:$PATH export PATH </pre></td></tr></table> <h1>Create a tomcat launcher script <img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2FuY2hvcjpDcmVhdGUgYSB0b21jYXQgbGF1bmNoZXIgc2NyaXB0fQ&locale=en_GB&version=2" data-macro-name="anchor" data-macro-default-parameter="Create a tomcat launcher script"></h1> <p>Create the <code>$(server.home)/tomcat.run</code> file with the following content (dont forget to expand the <code>$(xxx)</code> variables with your defined values)</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> #! /bin/sh su - msu -c "cd; . ~/tomcat.env; tomcat $1" </pre></td></tr></table> <p>Change the permisions of that file : <code>chmod ug+x $(server.home)/tomcat.run)</code></p> <h1>Configure the wrapper service to run tomcat<img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2FuY2hvcjpDb25maWd1cmUgdGhlIHdyYXBwZXIgc2VydmljZSB0byBydW4gdG9tY2F0fQ&locale=en_GB&version=2" data-macro-name="anchor" data-macro-default-parameter="Configure the wrapper service to run tomcat"></h1> <p>Copy the file <code>wrapper.conf.in</code> from the wrapper service distribution to the <code>$(tomcat.home)/conf</code> directory</p> <p>Ensures its content is (dont forget to expand the <code>$(xxx)</code> variables with your defined values)</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> wrapper.java.command=%JAVA_HOME%/bin/java wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperStartStopApp wrapper.java.classpath.1=$(tomcat.home)/common/lib/wrapper.jar wrapper.java.classpath.2=%JAVA_HOME%/lib/tools.jar wrapper.java.classpath.3=/$(tomcat.home)/bin/bootstrap.jar wrapper.java.classpath.4=$(tomcat.home)/bin/commons-logging-api.jar wrapper.java.library.path.1=$(tomcat.home)/common/lib wrapper.java.additional.1=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager wrapper.java.additional.2=-Djava.util.logging.config.file=$(server.tomcat.base)/conf/logging.properties wrapper.java.additional.3=-Djava.endorsed.dirs=$(tomcat.home)/common/endorsed wrapper.java.additional.4=-Dcatalina.base=$(server.tomcat.base) wrapper.java.additional.5=-Dcatalina.home=$(tomcat.home) wrapper.java.additional.6=-Djava.io.tmpdir=$(server.tomcat.base)/temp wrapper.java.additional.7=-d64 wrapper.java.additional.8=-server wrapper.java.additional.9=-Xincgc wrapper.java.additional.10=-Xms128m wrapper.java.additional.11=-Xmx512m wrapper.java.additional.12=-Xss256m wrapper.java.additional.13=-XX:MaxPermSize=256m wrapper.app.parameter.1=org.apache.catalina.startup.Bootstrap wrapper.app.parameter.2=1 wrapper.app.parameter.3=start wrapper.app.parameter.4=org.apache.catalina.startup.Bootstrap wrapper.app.parameter.5=true wrapper.app.parameter.6=1 wrapper.app.parameter.7=stop wrapper.console.format=PM wrapper.console.loglevel=INFO wrapper.logfile=../logs/wrapper.log wrapper.logfile.format=LPTM wrapper.logfile.loglevel=INFO wrapper.logfile.maxsize=0 wrapper.logfile.maxfiles=0 wrapper.syslog.loglevel=NONE wrapper.console.title=@app.long.name@ wrapper.ntservice.name=@app.name@ wrapper.ntservice.displayname=@app.long.name@ wrapper.ntservice.description=@app.description@ wrapper.ntservice.dependency.1= wrapper.ntservice.starttype=AUTO_START wrapper.ntservice.interactive=false </pre></td></tr></table> <p>As a tip to ensure Tomcat is not using too much memory, remove the default applications from your tomcat and only keep the tomcat manage servlet (with a properly defined user)</p> <h1>Link the tomcat launcher script to the init scripts directory<img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2FuY2hvcjpMaW5rIHRoZSB0b21jYXQgbGF1bmNoZXIgc2NyaXB0IHRvIHRoZSBpbml0IHNjcmlwdHMgZGlyZWN0b3J5fQ&locale=en_GB&version=2" data-macro-name="anchor" data-macro-default-parameter="Link the tomcat launcher script to the init scripts directory"></h1> <p>To perform this action you should be logged as root.</p> <p>Execute the command <code>ln -s $(server.home)/tomcat.run /etc/init.d/tomcat</code>.</p> <p>Ensure Tomcat can be run with <code>/etc/init.d/tomcat start</code>.</p> <p>Verify Tomcat is running with <code>ps axfu | grep tomcat</code>. The tomcat process should be run by MSU</p> <p>Test Tomcat by pointing your web browser to <code><a class="external-link" href="http://localhost:8080/" rel="nofollow">http://localhost:8080/</a></code></p> <h1>Link the tomcat init script to the revelant init levels<img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2FuY2hvcjpMaW5rIHRoZSB0b21jYXQgaW5pdCBzY3JpcHQgdG8gdGhlIHJldmVsYW50IGluaXQgbGV2ZWxzfQ&locale=en_GB&version=2" data-macro-name="anchor" data-macro-default-parameter="Link the tomcat init script to the revelant init levels"></h1> <p>To perform this action you should be logged as root.</p> <p>Execute the commands <code>ln -s /etc/rc3.d/S99tomcat /etc/init.d/tomcat</code> and <code>ln -s /etc/init.d/K99tomcat /etc/init.d/tomcat</code></p> <p>Verify with the same method as above after rebooting your server to ensure tomcat is run as a service.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced