Wednesday, September 10, 2008

The Tomcat environment for FreeBSD

3.2 The Tomcat environment for FreeBSD

It is very simple to install Tomcat on a FreeBSD machine, after setting up the necessary Java environment, which we have previously completed.

In-order to set up Tomcat on FreeBSD, follow the below procedure:

  1. Follow the above steps to set up the necessary Java environment.

  2. Set an environment variable JAVA_HOME which, points to the directory where you have installed the JDK (the examples below point to a native build of the JDK). If you are using sh(1) as your shell, you can set JAVA_HOME with:

    # export JAVA_HOME="/usr/local/jdk1.3.1"

    Those who use csh(1) or a compatible shell, must use a slightly different command:

    # setenv JAVA_HOME /usr/local/jdk1.3.1

    This environment variable should be made permanent by adding it into either .profile or .cshrc, depending on the shell you are using. This variable is very crucial for the functioning of all the Java based programs, including Tomcat itself.

  3. Download the Tomcat “binary distribution” from the Jakarta website, which is located at http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.6/bin/. The file to download is called jakarta-tomcat-4.0.6.tar.gz.

  4. The compressed and archived file we downloaded in the previous step uses special “GNU Extensions”. In-order to untar and uncompress the file, we will need to install GNU Tar (archivers/gtar), by doing the following:

    # cd /usr/ports/archivers/gtar && make all install clean
  5. Un-tar and Un-compress the jakarta-tomcat-4.0.6.tar.gz file into the /usr/local directory and rename the directory to tomcat-4.0 for ease of reference:

    # cd /usr/local
    # gtar zxvf jakarta-tomcat-4.0.6.tar.gz
    # ls jakarta*
    jakarta-tomcat-4.0.6
    # mv jakarta-tomcat-4.0.6 tomcat-4.0

    You can remove the jakarta-tomcat-4.0.6.tar.gz at your preference.

Note: Installation by using the source code is currently out of scope for this document. Please refer to the following files for addition information on building from source, available from your Tomcat distribution directory:

  • /usr/local/tomcat-4.0/README.txt

  • /usr/local/tomcat-4.0/BUILDING.txt

No comments: