Sunday, February 06, 2005

Tomcat 4.1 + Apache 1.3 + mod_jk + Debian 3.0 (Woody)
(This is still in progress, Not quite finished yet)

This is a little install guide on how to install Tomcat 4.1 with Apache 1.3 using mod_jk on Debian.

Install and setup Tomcat 4.1
First off I went to apache.org and downloaded the latest version of Tomcat 4.1's bin distribution, I am using the binary distro instead of the debian package because I want to have more then one tomcat install, and the easiest way to do this is to not use the package.

Once you get the file extract it to /usr/local/tomcat.version (tar -xvzf tomcat.tar.gz)
Create a link from this install directory to /usr/local/tomcat4 (ln -s /usr/local/tomcat.version /usr/local/tomcat4) .
Go into tomcats conf dir (cd /usr/local/tomcat4/conf)
Edit the server.xml file so that it is using the ports that you want to use and make sure the mod_jk connector settings aren't commented out.
Remember what ports you used for the tomcat server (usually 8080 by default) and the mod_jk connector (usually 8009 is default).

Install and Setup Apache 1.3
Apache 1.3 is in the stable branch of woody so if you don't already have it installed all you need to do is an (apt-get install apache) .
If you are not sure if you have apache installed you can do an (dpkg -l apache*) and it will list any packages that you have installed that start with apache.

If you don't want to use the stable branch you can get a backported copy from (deb http://packages.dotdeb.org ./) This is where I got mine. Just add this entry to your (/etc/apt/sources.list) file, then do an apt-get update and then an ( apt-get install
apache=1.3.26-0.dotdeb.1) Or what ever the latest version is. I am using this package because I also want to setup PHP and I found this was the easiest package to use when trying to get php4 and MySQL 4.1 connected.

Install mod_jk
You will also need to install the apache module mod_jk. I got this file from backports.org.
Add the following line to your (/etc/apt/sources.list) file and then do an apt-get update.

deb http://www.backports.org/debian stable libapache-mod-jk

Then you can install it using the following command.

apt-get install libapache-mod-jk=1.2.5-1.backports.org.1

Configure Apache
Once apache is installed you will need to edit the httpd.conf file which is usually in (/etc/apache/httpd.conf).

Add the following lines.
#########################################
#This will load the jk module
LoadModule jk_module /usr/lib/apache/1.3/mod_jk.so

#This is to configure mod_jk if you don't have a workers.properties file make sure you read below.
JkWorkersFile /etc/apache/workers.properties
JkLogFile /var/log/apache/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

#setup your virtual host so that it will forward all requests to tomcat.
<VirtualHost *>
ServerAdmin help@example.com
ServerAlias www.example.com
DocumentRoot /var/www
ServerName example.com
JkMount /* ajp13
ErrorLog logs/example-com-error_log
CustomLog logs/example-com-access_log combined
</VirtualHost>

#################################

(if you get an error that the log files can't be written, then you will most likely need to create a link from /var/log/apache/ to /etc/apache/logs (ln -s /var/log/apache /etc/apache/logs) )

Setup the workers.properties file
#######
# Setup for Debian system
#Set your tomcat_home to where you installed tomcat
workers.tomcat_home=/usr/local/tomcat4
#set your java home to where you have java installed.
workers.java_home=/usr/lib/j2sdk1.4-sun
ps=/
worker.list=ajp13

# Definition for Ajp13 worker This is what you setup in tomcats server.xml file
#
worker.ajp13.port=8009
#Set to localhost if tomcat server is on the same box as apache, if not put the domain name or ip of the tomcat server.
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
#######

Startup and Test
Now that you have this setup, you can start apache and tomcat and test it out to see if it works. If it doesn't work, check the logs to see what the problem is.

/etc/init.d/apache start
/usr/local/tomcat4/bin/statup.sh

If you want tomcat to statup when the server starts add a start and stop script into /etc/init.d/ and then created symbolic links into the various /etc/rc#.d directories. Look at the scripts inside of /etc/init.d/ for an example of how to do this.

More Links:
Here is a link to another good install guide for apache 1.3 tomcat 4.1 and mod_jk.

I hope this was of some help to someone. I know it will help me when I need to do this again, in the future.

Ken Cochrane
(work in progress)
Last Updated: 02-06-05





0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home