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

Preparing your server

Prepare your server by configuring your variables, editing your configuration files, creating users, and more.

Set your paths

In addition to the tools that must be installed on the server, you need to have all your PATH variable settings for your shell set up correctly. The PATH variables tell the shell where to look for certain software installations, tools, and so on.

Check your Java version

To check which version of Java technology you're using, use the command java -version. You should then see something like this:

bash-3.00# java -version
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)


First, you must install the JRE according to the instructions included with the release. I typically choose to use the full Java software development kit (JDK) rather than just the JRE. If you do, too, set your JAVA_HOME environment variable to the path name of the directory into which you installed the JDK (for example, /usr/local/java/j2sdk5.0). Use the following code to set your JAVA_HOME variable:

bash-3.00# export JAVA_HOME=/usr/jdk/instances/jdk1.5.0

You can also run:

JAVA_HOME=/usr/bin/java; export JAVA_HOME'

(there's really no difference).

Type an echo command to double-check that the command worked:

bash-3.00# echo $JAVA_HOME

CATALINA_HOME (Tomcat's default home directory)

CATALINA_HOME is used to refer to the full path name of the release directory. Use the following code to set this variable on your server:

bash-3.00# export CATALINA_HOME=/opt/apache-tomcat-6.0.16 

This code pertains specifically to the Tomcat version you have installed. When in doubt, name it after the .tar file you extract, because that carries with it the correct version in the name.

Edit the shell and configuration file under your user

You probably noticed that I have a few references to Bash in the command samples. Without getting into boring details, users logged in to UNIX run out of shells on the server to execute a CLI that allows them to navigate and administer the server. This is not unlike other operating systems but is more flexible in that you can define that shell by typing something like Bourne shell (sh) or Bourne-again shell (bash).

In addition, depending on which shell you're using, you can edit the custom shell profile for your CLI to automatically set PATH variables and even alias characters to represent useful common commands on the server. To do this, edit .bashrc, .profile (the default under the bash shell), and so on. Use the vi editor to create this file, then edit it appropriately under your root, personal, or Tomcat-specific user ID to ensure that the PATH variables will be set each time you log in to the server.

Under your home directory, create the .profile file (shown in Listing 1), if it does not exist already, using the standard UNIX editor, vi.

Listing 1. Create your .profile using a standard UNIX editor
cd ~/ (home dir)
vi .profile

Type i (for insert), and then add each path you set above. An example may look something like this:

# /bin/sh
stty istrip
export PATH
umask 077

export SHELL=/usr/bin/ksh
export ENV=$HOME/.kshrc
export EDITOR=vi
export FCEDIT=vi

#Tomcat specific PATHs

export JAVA_HOME=/usr/jdk/instances/jdk1.5.0
export CATALINA_HOME=/opt/apache-tomcat-6.0.16

This may also be a good time to add additional PATH variables to cover all the areas in which you have tools installed that you're going to reference. For my setup, I also need to create the following two paths:

bash-3.00# PATH=/usr/ccs/bin:$PATH; export PATH (for make cmd)
bash-3.00# PATH=/usr/sfw/bin:$PATH; export PATH

Users and groups

If multiple users will use your server, you definitely want to set up user and group privileges to allow your different users access to various tools and file systems. This is also necessary if you're going to run your Tomcat installation as a non-root user (recommended for most production environments). I will get into the details of this in a later tutorial; however, here are some commands to chew on.

To create a Tomcat group, use the code in Listing 2.

Listing 2. Create a unique group for Tomcat to run under
/usr/sbin/groupadd -g {specific gid. Leave this blank and the OS will assign you a gid} 
{group name}
/usr/sbin/groupadd -g 10004 tomcatgroup

To create a Tomcat user, use the code in Listing 3.

Listing 3. Create a unique user for Tomcat to run under
/usr/sbin/useradd -d {user home directory} -g {user primary group} -u 
{specific UID. You can leave this blank, and the operating system will assign you a UID.) 
-s {default shell path for this user} -c "{Description of the user}" {username}
/usr/sbin/useradd -d /export/home/tomcat -g tomcatgroup -u 10010 -s /bin/ksh -c 
"Main Tomcat Administrative User" tomcat

4 of 11 | Previous | Next


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