Notes on Installing and Configuring Tomcat

<< Click to Display Table of Contents >>

Navigation:  Analyzing Data in s-Server > Running Demo Applications > The Edamame Demo >

Notes on Installing and Configuring Tomcat

Previous pageReturn to chapter overviewNext page

On many Linux distributions, Apache Tomcat is either installed automatically or available as an added package. You should be able to install and use the standard package for your distribution. You can also download and install your own version from Apache.

Downloading and Installing

Tomcat is free, open-source software from the Apache Software Foundation. You can download the latest at http://tomcat.apache.org/download-55.cgi. We developed and tested the demo on 5.5.16, but newer 5.5.x versions should work. The apache-tomcat-5.5.16.tar.gz download was about 5.6 MB. The one you want is called the "Core" distribution.

To install the downloaded package, untar or unzip the package in a place you want to use it, such as in /usr/local, so you have /usr/local/apache-tomcat-5.5.x, which you can then symlink to /usr/local/tomcat.

Define an environment variable that points to this directory, for example:

CATALINA_HOME=/usr/local/tomcat

 

If you run into any problems installing, the file $CATALINA_HOME/RUNNING.txt+] offers useful information. There is also a Tomcat FAQ on the Apache site.

Creating a Tomcat User and Role

In order to deploy applications, you need rights to access the Tomcat manager application.

Edit the file $CATALINA_HOME/conf/tomcat-users.xml and add the following:

  <role rolename="manager"/>

   <user username="SQLstream" password="mypassword" role="tomcat,manager"/>

 

This gives you the ability to deploy and undeploy applications in the Tomcat Manager web application. Note that the password is stored here in plain text. As a result, you should not a valuable or secure password.

Altering Security Policy

Next, you need to grant the Edamame web application sufficient rights to read and write files and read environment variables. To do this, you need to edit the file

$CATALINA_HOME/conf/catalina.policy

 

adding the following lines:

// permissions for Edamame web application

grant codeBase "file:${catalina.home}/webapps/edamame/-" {

   permission java.security.AllPermission;

};

 

This gives the application all permissions, including those needed for the demo.

Note: Some installations of Tomcat do not allow you to edit catalina.policy directly. In these cases, you need to build that file automatically from smaller policy files in $CATALINA_HOME/conf/policy.d/.

Here, you can add Edamame permissions to a file called webapp.policy or a separate edamame.policy.

Starting and Stopping Tomcat

If you install Tomcat as a Linux package (rather than installing it from Apache directly), it likely sets itself up to run as a service. You can generally start or stop the service either by using a graphical tool from the desktop or by calling a script (probably called either tomcat or tomcat5.5) in /etc/init.d.

Tomcat comes with shell scripts to start and stop the server (called startup.sh and shutdown.sh, respectively), installed in $CATALINA_HOME/bin.

Note: For purposes of the Edamame demo, you need to make sure your environment is set up correctly before starting Tomcat. In particular, you need to make sure ${SQLSTREAM_HOME} points to the proper place. You can either handle this by setting it in the global environment (which varies by installation: /etc/profile and /etc/environment are good places to look) or by modifying the startup.sh script directly to set SQLSTREAM_HOME.