The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации / Документация по FreeBSD / Руководства по FreeBSD на английском

3 Jakarta Tomcat Setup

3.1 Overview

Java is becoming an even more popular for making diverse and scalable platform independent solutions. One of the most growing needs of Java is in the ASP (Application Service Provider) market. Java serves as the perfect solution for these types of markets, with the following advantages:

A very important and growing technology which has emerged from Java is JSP (JavaServer Pages).

JSP (JavaServer Pages) is a server-side technology introduced by Sun Microsystems Corp., which provides a quick simple way to generate dynamic content from within HTML pages. It uses XML tags along with Java scriptlets to encapsulate and separate the logic from the design and display. When a JSP page is invoked, it is dynamically converted into a Servlet and processed by the server to produce the resulting HTML/XML page for the client. When JSP is used in conjunction with JavaBeans, it is possible to produce very diverse and scalable applications, which may be combined with the strength and performance of FreeBSD.

Tomcat is an open-source implementation of the Java Servlets and JavaServer Pages technologies, developed under the Jakarta project at the Apache Software Foundation. Tomcat implements a new Servlet framework (called Catalina) that is based on completely new architecture with the Servlet 2.3 and JSP 1.2 specifications. It includes many additional features that make it a useful platform for developing and deploying web applications and web services. In a nutshell, Tomcat is an application server written in 100% Pure Java.

Tomcat is used for many purposes, and is not limited to Application Servers. It provides an open platform to develop extensible web and content management services. When Tomcat is used with an optimized FreeBSD system, it can provide highly reliable and fast pacing services.

Please refer to the reference section for more information on Tomcat and JSP. The next section will demonstrate how to build the ``Tomcat Environment'' for FreeBSD. The version of Tomcat used in this guide is 4.0.3. This version contains major bug fixes, and the following updates/changes:

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 setup Tomcat on FreeBSD, follow the below procedure:

  1. Follow the above steps to setup 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 The file to download is called jakarta-tomcat-4.0.3.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.3.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.3.tar.gz
        # ls jakarta*
        # mv jakarta-tomcat-4.0.3 tomcat-4.0

    You can remove the jakarta-tomcat-4.0.3.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

3.3 Operating Tomcat - Basics

Now that we have finished installing Tomcat. The following example shows how to start the Tomcat server:

    # cd /usr/local/tomcat-4.0/bin
    # ./  (for starting Tomcat)

You can test if your Tomcat server has started by visiting the following URL: or http://localhost:8080. To stop Tomcat:

    # cd /usr/local/tomcat-4.0/bin
    # ./

(for stopping Tomcat)

The and are frontends to the executable script in the same directory; if you would like to start Tomcat automatically at boot-time run:

    # cd /usr/local/etc/rc.d
    # ln -s /usr/local/tomcat-4.0/bin/

Edit the, and add the following at the beginning of the file (after the comment box):


If your port 8080 is occupied by some other service, you can change it by editing the server.xml in your Tomcat's conf/ directory. In the example below, the port will be changed to 80, assuming there is no service running on that port.

    # cd /usr/local/tomcat-4.0/conf
    # fgrep -n 8080 server.xml
    ~65:         By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
    ~89:         port="8080" minProcessors="5" maxProcessors="75"
    # cat server.xml | sed s/8080/80/ >
    # mv

This, and other documents, can be downloaded from

For questions about FreeBSD, read the documentation before contacting <>.
For questions about this documentation, e-mail <>.

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру