Sun Cluster 3.1 Data Service for Apache Tomcat Guide

How to Install and Configure Apache Tomcat

Use this procedure to install and configure Apache Tomcat.

  1. Determine how Apache Tomcat will be deployed in Sun Cluster – Here you need to determine how Apache Tomcat will be deployed.

    • Determine whether Apache Tomcat shall be used as a failover or a scalable data service.

      For conceptual information on scalable and failover data services, see the Sun Cluster Concepts Guide.

    • Determine which user name shall run Apache Tomcat.

    • Determine how many Apache Tomcat versions and instances will be deployed.

    • If more than one instance of a version sill be deployed, determine whether they share the binaries.

    • Determine what Cluster File System will be used by each Apache Tomcat instance.

  2. Mount Apache Tomcat Cluster File Systems – After you have determined how Apache Tomcat will be deployed within Sun Cluster, you need to ensure the Cluster File Systems are mounted.


    Caution – Caution –

    In this scenario, the deployment of Tomcat applications needs to occur on every node where Apache Tomcat is hosted.


  3. If Apache Tomcat is supposed to run under a non root user name, create the appropriate user name and to create group use the following commands.

    • # groupadd —g 1000 tomcat

    • # useradd —u 1000 —g 1000 —d /global/tomcat —s /bin/ksh tomcat

  4. If you deploy Apache Tomcat as a failover data service install Apache Tomcat onto a shared file system within Sun Cluster. It is recommended that Apache Tomcat is installed onto shared disks, however for a discussion of the advantages and disadvantages of installing the software on a local versus a cluster file system, see “Determining the Location of the Application Binaries” of the Sun Cluster Data Services Installation and Configuration Guide.

    If you deploy a scalable configuration prefer to install Apache Tomcat onto local disks.

    • Switch to the appropriate user name, if it is not root with # su — user name

    • If Apache Tomcat shall be deployed as a failover data service install the Apache Tomcat binaries on the shared storage on one node. If Apache Tomcat shall be deployed as a scalable data service, install the Apache Tomcat binaries on every node that shall host the Apache Tomcat data service.


      Note –

      Follow http://jakarta.apache.org/tomcat/index.html instructions to install Apache Tomcat.


      If you deploy Apache Tomcat as a scalable data service for a scalable or a multiple masters configuration, repeat the following step at every node that will host Apache Tomcat.

    • Create an korn shell or a c-shell script (dependent of the login-shell of your Apache Tomcat user name) to set the environment variables for Apache Tomcat. It is required to set the environment variables in a shell script and not in the users profile.

      With this mechanism you can install and run multiple Apache Tomcat versions and instances under one user name.


      Caution – Caution –

      These shell scripts needs to be available on every node that can host the Apache Tomcat data service. For a failover configuration store them on the shared storage. For a scalable or a multiple masters configuration, store them on the local file system of every node, or on the shared storage. These scripts must not differ on the various nodes.



      Example 1–2 korn shell script to set the environment variables for Apache Tomcat 3.x/3.3


      # more env.ksh
      #!/usr/bin/ksh
      #
      # Environment for Tomcat
      #
      JAVA_HOME=/usr/j2se
      export JAVA_HOME
      JAKARTA_HOME=/global/mnt1/jakarta-3.3
      export JAKARTA_HOME
      TOMCAT_HOME=$JAKARTA_HOME
      export TOMCAT_HOME


      Example 1–3 C-shell script to set the environment variables for Apache Tomcat 3.3/3.3


      # more env.csh
      #!/usr/bin/csh
      #
      # Environment for Tomcat
      #
      
      setenv JAVA_HOME /usr/j2se
      setenv JAKARTA_HOME /global/mnt1/jakarta-3.3
      setenv TOMCAT_HOME $JAKARTA_HOME


      Example 1–4 korn shell script to set the environment variables for Apache Tomcat 4.1.x


      # more env.ksh
      #!/usr/bin/ksh
      #
      # Environment for Tomcat
      #
      JAVA_HOME=/usr/j2se
      export JAVA_HOME
      CATALINA_HOME=/global/mnt1/jakarta-tomcat-4.1.18
      export CATALINA_HOME


      Example 1–5 C-shell script to set the environment variables for Apache Tomcat 4.1.x


      # more env.csh
      #!/usr/bin/csh
      #
      # Environment for Tomcat
      #
      setenv JAVA_HOME /usr/j2se
      setenv CATALINA_HOME /global/mnt1/jakarta-tomcat-4.1.18

      The environment variables are version and configuration dependent.


Note –

For more detailed information about Apache Tomcat, refer to jakarta.apache.org webpage.