Installation of Apache 2.2.6, Tomcat 6.0.14 and Mod_JK Connector 1.2.25 on Debian Etch

I’ve spent a lot of time googling on the Internet in order to find an update information on how to incorporate Apache with Tomcat. However, most of them are outdated. So, I took instructions from several sources together and did some experimentations with a success. Here is what I set up Apache 2.2.6 and Tomcat 6.0.14 on my Debian Etch machine.

1) Apache httpd-2.2.6

– Download httpd-2.2.6.tar.gz from Apache web site.

– Unzip it

>tar zxvf httpd-2.2.6.tar.gz

Now, we will have an unzipped directory called “httpd-2.2.6″.

– Next, we need to change directory to httpd-2.2.6, compile and install it. However, before we can do it in Debian Etch, we need to install “gcc” and “libc-dev” using Synatic Package Manager. I guess whoever is using Debian Etch should know how to do it. After installing “gcc” and “libc-dev” packages, we are ready to install the httpd server. In my system, I install any additional package in the /opt directory.

As a normal user, I issue the following commands:

>cd httpd-2.2.6

>./configure –prefix=/opt/httpd-2.2.6


Then, I change to root because installing software in /opt directory requires root privileges.


>make install

– Test the installation

As root,

>cd /opt/httpd-2.2.6

>bin/apachectl start

Open a web browser. On the address bar, enter: http://localhost/

Issue the following command to stop the server

>bin/apachectl stop

2) Sun JDK 1.6.0_02

To be able to run Tomcat server, we need to have a java installed. I download jdk1.6.0_02 from Sun web site and install it in the /opt directory.

– Download jdk1.6.0_02 selft extraction file (NOT rpm), jdk6u2-linux.i586.bin

– Add execute permission to the downloaded file.

>chmod u+x jdk6u2-linux.i585.bin

– Change to root


– Install Java


– Follow the instructions on the screen to install Jdk in /opt directory (by default) in Debian Etch.

3) Install and setup Java path.

In Linux, we can set up path in the ~/.bashrc file. However, I will set my customized path in a new file called “.mysetup”.

So, I create “.mysetup” file in my home directory, and add the following line.

As a normal user,


>vi .mysetup

In “.mysetup” file, I add:



export JAVA_HOME


export PATH


Then, I edit and add a line at the end of “.bashrc” file in my home directory.

>vi .bashrc

At the end of “.bashrc” file, add this line


source ~/.mysetup


Next, I activate the change in my PATH and JAVA_HOME environment variables.

>source .bashrc

An alternative approach for setting the new installed JDK java path is to use “update-alternatives” command. After installing Sun JDK using Step 2 above, follow these steps.

>update-alternatives –install /usr/bin/java java /opt/jdk1.6.0_02/bin/java 300

>update-alternatives –config java

Then, there will be a list of java packages that are installed in our system. Select /opt/jdk1.6.0_02/java. As a result, the /opt/jdk1.6.0_02 will be our default java.

4) Apache Tomcat 6.0.14

– Download apache-tomcat-6.0.14.tar.gz from Apache Tomcat web site.

– Unzip it

>tar zxvf apache-tomcat-6.0.14.tar.gz

Now, we will get an unzipped directory called “apache-tomcat-6.0.14″

As mentioned earlier, I install any additional package in the /opt directory which requires root privileges. So, I change to root.


Then, I move the unzipped apache-tomcat-6.0.14 directory to /opt

>mv apache-tomcat-6.0.14 /opt/

Next, setup CATALINA_HOME environment

As a normal user,


>vi .mysetup

Add these line before PATH environment





-Test the installation

As a normal user,

>cd /opt/apache-tomcat-6.0.14


Open a browser. At the address bar, enter: http://localhost:8080/

To shutdown the Tomcat server,


5) Install Apache HTTPD and Tomcat connector (mod_jk)

– Download tomcat-connector-1.2.25-src.tar.gz from Tomcat web site

– Unzip it

>tar zxvf tomcat-connector-1.2.25-src.tar.gz

Now, we will get an unzipped directory called, tomcat-connector-1.2.25-src

We are ready to compile and install this connector.

>cd tomcat-connector-1.2.25-src

>cd native

>./configure –with-apxs=/opt/httpd-2.2.6/bin/apxs

For the above step, we might have to get into the /opt/httpd-2.2.6 installed directory and check where the “apxs” really is.

In this case, “apxs” is in the /opt/httpd-2.2.6/bin directory.



>make install

The result of this connector installation is that the “” file will be put in the /opt/httpd-2.2.6/modules directory.

– Check if the is really in the /opt/httpd-2.2.6/modules directory, and check if its permission is 755. We need to change the permission of the to 755.

– Next, we need to configure mod_jk for Tomcat and Apache. We need to do two things, one is to create a “” file and put it in the “/opt/httpd-2.2.6/conf” directory, and second is to edit httpd.conf file.

The “” can be created as follows:


Add the following lines










– Save the file above and put it in $APACHE_HOME/conf directory. Notice the “worker.list=myworker” line. “myworker” is the name of worker. We can use any name we want. The worker name will be also used in editing httpd.conf file in the next step.

– Edit httpd.conf file

>cd /opt/httpd-2.2.6/conf

>vi httpd.conf

Add the following lines at the end of the “httpd.conf” file.


# My mod_jk settings

#Load mod_jk module

LoadModule jk_module modules/

#Where to find

JkWorkersFile conf/

#Where to put jk logs

JkLogFile logs/mod_jk.log

#Set the jk log level

JkLogLevel debug

# Select the log format

JkLogStampFormat “[%a %b %d %H:%M:%S %Y]”

#JkOptions indicate to send SSL KEY SIZE

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

#JkRequestLogFormat set the request format

JkRequestLogFormat “%w %V %T”

# Send JSPs for context /ROOT to worker named “myworker”

JkMount /*.jsp myworker

# Send /ROOT to worker named “myworker”

JkMount /* myworker


– Test the installation

Start the httpd server


>cd /opt/httpd-2.2.6

>bin/apachctl start

As a normal user, start the Tomcat server

>cd /opt/apache-tomcat-6.0.14


Open a web browser, at the address bar, enter: http://localhost/

Now, we should be able to access the Tomcat startup page through port 80.

6) Disable HTTP access to Tomcat applications through port 8080.

– Edit “server.xml” in the Tomcat installation directory

>vi server.xml

Comment out the whole <Connector port=”8080″ protocol=”HTTP” …> element.

That’s about it for the installation. Any comment or suggestion is very welcomed.

[Updated: September 25, 2007] After the installation, we might have a problem of accessing the web server from outside network such as LAN. One possible cause is a Firewall settting. We can create rules in iptables or we can use a firewall front end program to do it for us. I use Firestarter to write a rule for allowing in-bound and out-bound HTTP service through port 80. In Debian, we can use Synaptic software package manager for installing the Firestarter program. [Note: I still cannot access my web server from outside my school LAN.]

[Updated: September 28, 2007] Since my school is too restricted regarding setting up a server, I cannot get a Static IP address for my Debian Etch machine. I think that to allow outside network (LAN) to access the server we need to setup static IP in Debian Etch first (default installation using DHCP). We cannot get static IP address only by issuing “/sbin/ifconfig” command, because it is usually a danamic IP address from DHCP server.

This entry was posted in Linux. Bookmark the permalink.

14 Responses to Installation of Apache 2.2.6, Tomcat 6.0.14 and Mod_JK Connector 1.2.25 on Debian Etch

  1. Marc says:

    Thank you for posting the information.

    Have you tried to install the tomcat-connector statically?

    ./configure \

    It seems that APR on httpd-2.2.6 is preventing me to successfully compile the connector.

    Thank you!

  2. mrtextminer says:

    Sorry. I have not tried to do it that way.

  3. Fabio says:

    Very Good !!! Tank you !!!

  4. Absar Mirza says:

    Thanks a million. It was of great help.

  5. jango says:

    Thanks a lot, It is great to have one a stop resource with all the instructions.

  6. Euler says:

    Hey Pal,

    that’s a great “quick reference”! I test in windows environment and everything works! good job!!! 🙂

  7. simon says:

    Great instructions. Thanks for posting.

  8. Johan says:

    Tnx for the help.

    I followed your advices but it might had been much easier to just type one commando:

    $ apt-get install libapache2-mod-jk2 (or jk on older -v)

    , on a debian (ubuntu) with jdk1.5 and apache2. And
    then enable the mod_jk module with 2 symbolic links on /etc/apache2/mod-enable.


  9. lwpro2 says:

    just make sure apache load the module, forward request to certain worker, which connect through tomcat ajp1.3 port correctly, not the tomcat service port.! that’s all.

  10. Eric says:

    Thank you sooooo much !

  11. Charles says:

    Thank you very much!

    You are The Best!

  12. Vinesh says:

    Thanks a lot.

  13. Manojkumar says:

    Thanks a lot for such a clear steps to install apache-tomcat.

  14. Kee says:

    Thanks a lot! It works well for me. I’ve installed Apache 2.2.x, Tomcat6 and mod_jk-1.2.37 in Redhat.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s