Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:

TUTORIAL: mod_jk2 (Apache Jakarta Connector)

by Casper Pedersen

With this tutorial, I will try to give you the steps to build the Apache Jakarta Connector also know as mod_jk2, as an RPM binary package from source.

UPDATED 2004-03-13 Updated to so that it builds on Fedora Core 3, also updated to mod_jk2-2.0.4. Mind that mod_jk2 is no longer supported, see here for more information. Get the updated spec file here, and download the latest (last) version of mod_jk2 here.

  1. Follow Thomas's instruction on howto create rpmbuild directory
  2. We need to modify some system files, therefor become root
    [casper@localhost casper]$ su -
    [root@localhost root]#
  3. Install Sun JVM or any other JVM which is 1.4.1 compliant (or newer). Make sure that you install JSDK (Java Software Developer Kit) as Jakarta Tomcat requires this.
    1. Make sure to create a enviroment variable for JAVA_HOME, the easiest is to add it to /etc/profile
      [root@localhost root]# echo "JAVA_HOME=<root directory to where ever you installed java>" >> /etc/profile
      [root@localhost root]# echo "export JAVA_HOME" >> /etc/profile
      [root@localhost root]#
    2. Make sure the it is included in the path (not compleatly need but nice to have)
      [root@localhost root]# echo "PATH=$PATH:$JAVA_HOME/bin" >> /etc/profile
      [root@localhost root]# echo "export PATH" >> /etc/profile
  4. Install Jakarta Tomcat 4.1.x.
    1. Download it from and save it to /opt
    2. Extract it:
      [root@localhost root]# cd /opt
      [root@localhost root]# tar zxfv jakarta-tomcat-4.1.29.tar.gz
      [root@localhost root]#
    3. Just to make your life easier make a symbolic link to it
      [root@localhost root]# ln -s jakarta-tomcat-4.1.29 tomcat
      [root@localhost root]#
    4. Create a start script for jakarta Tomcat in /usr/local/bin
      [root@localhost root]# vi /usr/local/bin/
      JAVA_HOME=<root directory to where ever you installed java>
      $TOMCAT_HOME/bin/ $*
    5. Try it out....
      [root@localhost root]# run
      Using CATALINA_BASE:   /opt/tomcat
      Using CATALINA_HOME:   /opt/tomcat
      Using CATALINA_TMPDIR: /opt/tomcat/temp
      Using JAVA_HOME:       /opt/java
      Jan 15, 2004 11:58:29 PM org.apache.coyote.http11.Http11Protocol init
      INFO: Initializing Coyote HTTP/1.1 on port 8080
      Starting service Tomcat-Standalone
      Apache Tomcat/4.1.29
      INFO: Starting Coyote HTTP/1.1 on port 8080
      Jan 15, 2004 11:58:35 PM org.apache.jk.common.ChannelSocket init
      INFO: JK2: ajp13 listening on /
      Jan 15, 2004 11:58:35 PM org.apache.jk.server.JkMain start
      INFO: Jk running ID=0 time=1/36  config=/opt/tomcat/conf/
    6. Use a browser; URL:http://localhost:8080 and you should see something like this
  5. Make sure that you have the following packages (or newer) installed on your build system: - httpd-2.0.48-1.2 - httpd-devel-2.0.48-1.2
    [root@localhost root]# yum install httpd httpd-devel
    .Dependencies resolved
    I will do the following:
    [install: httpd 2.0.48-1.2.i386]
    [install: httpd-devel 2.0.48-1.2.i386]
    I will install/upgrade these to satisfy the dependencies:
    [deps: apr-util-devel 0.9.4-2.i386]
    [deps: apr-util 0.9.4-2.i386]
    [deps: apr 0.9.4-2.i386]
    [deps: apr-devel 0.9.4-2.i386]
    Is this ok [y/N]: y
    [root@localhost root]#
  6. There seams to be a bug in httpd-devel which make 'make mod_jk2' look for libtool in '/etc/httpd/build' Redhat Bugzilla #113720 Apache Bugzilla #26206 For more information about this, read the description for the bug's. To get around this do:
    [root@localhost root]# ln -s /usr/bin/libtool /etc/httpd/build/libtool
    [root@localhost root]#