Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Introduction

In order to Run Tomcat as a linux service, you should follow these steps:

  1. #Install the wrapper service
  2. #Create a tomcat environment definition script
  3. #Create a tomcat launcher script
  4. #Configure the wrapper service to run tomcat
  5. #Link the tomcat launcher script to the init scripts directory
  6. #Link the tomcat init script to the revelant init levels

Install the wrapper service

Download the wrapper service binaries for Linux (http://wrapper.tanukisoftware.org)

Copy the binaries as defined in (http://wrapper.tanukisoftware.org/doc/english/integrate-simple-nix.html):

  • copy the wrapper file in the $(tomcat.home)/bin directory,
  • copy the sh.script.in file in the {{$(tomcat.home)/bin directory and rename it to tomcat,
  • copy the wrapper.jar file in the $(tomcat.home)/common/lib directory.

Edit the newly renamed tomcat file to ensure the following lines are defined.

Change the permisions of that file : chmod ug+x $(tomcat.home)/bin/tomcat)

Create a tomcat environment definition script

Create the $(server.home)/tomcat.env file with the following content (dont forget to expand the $(xxx) variables with your defined values)

Create a tomcat launcher script

Create the $(server.home)/tomcat.run file with the following content (dont forget to expand the $(xxx) variables with your defined values)

Change the permisions of that file : chmod ug+x $(server.home)/tomcat.run)

Configure the wrapper service to run tomcat

Copy the file wrapper.conf.in from the wrapper service distribution to the $(tomcat.home)/conf directory

Ensures its content is (dont forget to expand the $(xxx) variables with your defined values)

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)

Link the tomcat launcher script to the init scripts directory

To perform this action you should be logged as root.

Execute the command ln -s $(server.home)/tomcat.run /etc/init.d/tomcat.

Ensure Tomcat can be run with /etc/init.d/tomcat start.

Verify Tomcat is running with ps axfu | grep tomcat. The tomcat process should be run by MSU

Test Tomcat by pointing your web browser to http://localhost:8080/

Link the tomcat init script to the revelant init levels

To perform this action you should be logged as root.

Execute the commands ln -s /etc/rc3.d/S99tomcat /etc/init.d/tomcat and ln -s /etc/init.d/K99tomcat /etc/init.d/tomcat

Verify with the same method as above after rebooting your server to ensure tomcat is run as a service.

  • No labels