Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Install and configure a development Web server in UNIX

Build a fast, functional, and free Web server while jump-starting your UNIX skills

Matthew Skamser, Software Consultant, Solution Destination, Inc.
author photo
Matthew L. Skamser is an IT consultant and Studio B author with more than 10 years of experience architecting, administering, troubleshooting, and tuning Web applications in enterprise server environments. His clients have included IBM, Lockheed Martin/United States Air Force, and WorldBank. He has multiple IBM Certified Systems Expert certifications and received his bachelor's degree in Computer Information Systems from Northern Arizona University. You can reach Matthew at

Summary:  Get a detailed, step-by-step approach to installing and configuring a development or test Apache Tomcat server. Along the way, pick up helpful tips on how to build and administer your Web or application server in a UNIX® environment.

Date:  15 Jul 2008
Level:  Intermediate PDF:  A4 and Letter (358 KB)Get Adobe® Reader®

Activity:  29066 views

Configure, compile, and start

All Apache products that I've worked with include steps for configuring, compiling, and starting the product. This process gets the code ready, tells the software how and where to install, and so on.

Configure the software

To configure the Tomcat software, type:


./configure --with-java=/usr/java


export JAVA_HOME

Compile the code

With the Tomcat software configured, it's time to compile it.

Build the binaries and libraries

Listing 5 shows the code for building the Tomcat binaries and libraries.

Listing 5. Build the binaries and libraries
# gunzip jsvc.tar.gz

# pwd

# tar -xvf jsvc.tar

# gmake 

Make sure that the path to gmake is in your PATHS (for example, ./sfw/bin/).

Note: The Tomcat site states that you should use the GNU make (gmake) instead of the native BSD make command on FreeBSD systems.

The code in Listing 6 generates the executable file, .jsvc. This file is required to successfully run Tomcat as a daemon.

Quick definition of jsvc

Jsvc uses three processes: a launcher process, a controller process, and a controlled process. The controlled process is also the main Java thread; if the Java Virtual Machine (JVM) crashes, the controller restarts it in the next minute. Jsvc is a daemon process, so it should be started as root; the -user parameter allows you to downgrade to an unprivileged user.

Listing 6. Set the permissions on jsvc and copy
chmod 775 jsvc
cp jsvc ..
cd ..

Start the server

You can start the server from the CLI or from a Java program as an embedded server. Furthermore, the server can run as a daemon, which will run automatically, similar to a service setup in a Windows environment.

Run the basic startup script

Listing 7 shows the basic startup script for Tomcat.

Listing 7. Run the basic startup script
cd ../logs

Check catalina.out for errors! If you use cat, vi, more, or less on this file, type shift G to go to the bottom of the file. Or, you can type something like:

tail -50 catalina.out

to check the last 50 lines of the file for errors.

Although doing so is beyond the scope of this tutorial, you can also customize the startup process by modifying the Tomcat code or by implementing your own LifecycleListeners.

Run the startup daemon

You can start the daemon using a variety of options, such as -user for non-root user, -pid to specify the .pid file location, and -errfile and -outfile to specify the error and output file logs, respectively. For a complete list, find your jsvc process, and type ./jsvc -help. Listing 8 shows an example of a jsvc startup script.

What's a daemon?

A daemon is a non-interactive server application that the operating system controls by a set of specified signals. Think services in Windows. This provides for a graceful shutdown of server applications; the operating system can notify a server application of its imminent shutdown, and the application has the ability to perform certain tasks before its process of execution is destroyed.

Listing 8. Example jsvc startup script
Bash#./jsvc –home /usr/jdk/instances/jdk1.5.0 \
–Dcatalina.home=/opt/apache-tomcat-6.0.16 \
-cp ./bin/bootstrap.jar -outfile ./logs/catalina.out \
-errfile ./logs/catalina.err \

It is also very helpful to use the script included under the jsvc/bin directory. However, you will need to edit the variables to make sure the paths and such match your environment.

Test your Tomcat installation

The base Tomcat installation installs an internal HTTP server—Coyote HTTP/1.1—on http port 8080. For this architecture and setup, you don't need a separate Apache HTTP Server. You can change the ports to a more typical Web server port, like 80, simply by editing the server.xml file under the $CATALINA_HOME directory tree. You can also change the default Secure Sockets Layer (SSL) port to a typical SSL port, port 443. The server.xml file is where Tomcat gets most of its core configuration server information.

You can verify whether you started Tomcat successfully by going to http://localhost:8080/. You should see a startup page similar to Figure 3.

Figure 3. Initial Tomcat administrative console welcome page
Tomcat initial startup page

6 of 11 | Previous | Next


Zone=AIX and UNIX
TutorialTitle=Install and configure a development Web server in UNIX