[SUN] Apache 2.0.43 / Tomcat 4.1.12 / mod_jk for Solaris 8 (SPARC)
Apache 2.0.43 / Tomcat 4.1.12 / mod_jk for Solaris 8 (SPARC)
(last updated 11/05/2002)
————————————————————————-
——-
First, you need a sane build environment. In the open source world, that means
GNU tools, not the tools included with a Sun Dev cluster install. Also make sure
you’ve installed the Sun Solaris 8_Recommended patch cluster.
You’ll also need openssl and openssh installed. I’m assuming here that if you
have a Sun server and you have root access to it that you have some basic
familiarity with system administration and know your way around a UNIX
command line.
So, bop on over to sunfreeware.com, pick your OS, and grab the following GNU
tools in Sun package format:
autoconf
automake
binutils
gcc (I used version 2.95.3)
glib
gzip
libtool
make
tar (don’t use the tar included with Solaris…make sure GNU tar is first in your
path)
wget
zlib
Install all of the packages listed above. Note that you’ll need to install gzip first, as
the other packages are compressed. The gzip package is not.
Apache + Tomcat is five major steps: build/install Apache, install JDK,
build/install Tomcat, build/install a connector, configure. Since Tomcat is 100%
Java, we’ll use the binary install instead of having to deal with ant. I spend more
time with Red Hat Linux than I do with Solaris, so my preference is to put things
in /usr/local. Die-hard Solaris folks will need to substitute /opt, /var, or whatever
as needed to suit their own preferences. Paths, in this scenario, don’t have
much effect as long as you can guarantee that they are consistent.
Build/Install APACHE
=====================
grab Apache source from a mirror. You want version 2.0.43. The filename is
httpd-2.0.43.tar.gz.
unpack it
read INSTALL file for instructions
build apache with: ./configure –prefix=/usr/local/apache2 –enable-ssl —
enable-module=so
If you see a message that says “configuring package in srclib/apr now” and the
build process seems to hang for several minutes, leave it alone, it will continue
after a bit.
when configure completes, run make.
when make completes, run make install.
You should now have an Apache instance in /usr/local/apache2. Verify
config: /usr/local/apache2/bin/apachectl configtest
If you get a “Syntax OK” message, startup
Apache: /usr/local/apache2/bin/apachectl start
Verify Apache is running: http://some.server.name You should see the Apache
welcome page
NOTE: Apache2 uses a shorthand notation for the group ID in httpd.conf. If you
have problems getting Apache2 to start on Solaris 8 from a default install, check
the Apache error log (/usr/local/apache2/logs/error_log) for an error message.
If you see one that says something like “[alert] (22)Invalid argument: setgid:
unable to set group id to Group 4294967295″ then edit httpd.conf, and change the
line that says “Group #-1” to “Group nobody” then start/restart
Apache. The
Solaris kernel has difficulty with the “#-1” shorthand notation if the Group ID
(gid)
is over 60000 for the group nobody, which it is in Solaris 8 64-bit.
Install JDK
=====================
go to java.sun.com and download J2SE for Solaris:
http://java.sun.com/j2se/1.4.1/download.html Note that if you have a
64-bit
Solaris install, you need to install the 32-bit J2SE first, then install the 64-bit J2SE.
I prefer the SDK versions over the JRE versions.
Install the 32-bit J2SE, and, if needed, the 64-bit J2SE. The 64-bit install simply
overwrites some files and installs some new ones into the same location used
for the 32-bit install, so do the 32-bit install first.
Set JAVA_HOME as an environment variable, pointing to the location of the J2SE
you just installed.
Build/Install TOMCAT
=====================
grab the Tomcat binary package for 4.1.12. Get it here:
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.12/bin/jakarta-
tomcat-4.1.12.tar.gz
unpack it to /usr/local. You should end up with /usr/local/jakarta-tomcat-4.1.12
add a symbolic link: ln -s /usr/local/jakarta-tomcat-4.1.12 /usr/local/tomcat
set CATALINA_HOME as an environment variable, pointing to /usr/local/tomcat
startup Tomcat to test your installation: /usr/local/tomcat/bin/startup.sh. Verify
the Tomcat examples are available at http://some.server.name:8080/examples
Build/Install Connector
=======================
The two connectors (JK and JK2) are different; JK2 is a complete rewrite of the
earlier JK/AJP13 protocol. We’ll cover building JK, with JK2 to come later.
Building JK Connector
=======================
NOTE: you can get a JK binary for Solaris 8 here:
http://jakarta.apache.org/builds/jakarta-tomcat-
connectors/jk/release/v1.2.0/bin/solaris8/. The version there was compiled
against Apache 2.0.42 and should be compatible with 2.0.43. You are welcome to
skip building JK from source and use the binary instead, but if you would rather
build from source, here’s how to do it:
Grab the connector source from the Jakarta site:
http://jakarta.apache.org/builds/jakarta-tomcat-
connectors/jk/release/v1.2.0/src/jakarta-tomcat-connectors-jk-1.2.0-src.tar.gz
Unpack it to /usr/local/src/
From this point on, CONNECTOR_HOME = /usr/local/src/jakarta-tomcat-
connectors-jk-1.2.0-src
cd CONNECTOR_HOME/jk/native. Be sure to READ the file named BUILDING.
run the buildconf script: ./buildconf.sh
you may see some error messages about aclocal and autom4te…these can be
ignored.
run the configure script: ./configure –with-
apxs=/some/path/to/apache2/bin/apxs
run make
the mod_jk.so file will be in CONNECTOR_HOME/jk/native/apache-2.0. Copy it to
your Apache modules directory.
Final Configuration
=======================
NOTE: these steps will allow access to the Tomcat examples via Apache on port
80. Successful use of the examples on port 80 shows that mod_jk is working
correctly, since Tomcat is configured to run on port 8080 by default for HTTP
requests.
Edit server.xml in CATALINA_HOME/conf.
look for a line that says “Server” and has a port of 8005. Add the following
directly
below:
<Listener className=”org.apache.ajp.tomcat4.config.ApacheConfig”
modJk=”/usr/local/apache2/modules/mod_jk.so” />
in the Host container add the following Listener directive (yes, it looks very similar
to the one above):
<Listener className=”org.apache.ajp.tomcat4.config.ApacheConfig”
append=”true” forwardAll=”false”
modJk=”/usr/local/apache2/modules/mod_jk.so” />
change the name parameter in the Host directive to your apache ServerName
(the default is localhost)
Edit httpd.conf in APACHE_HOME/conf.
– make sure your ServerName matches the name=”” parameter in your tomcat
Host element in server.xml
– add the following line at the very end:
Include /usr/local/tomcat/conf/auto/mod_jk.conf
Note: the mod_jk.conf file gets created by tomcat when tomcat starts. It gets
created every time tomcat starts. So, if you have your server.xml configured, you
can ignore httpd.conf (in most cases) except to add the Include directive for
mod_jk.conf. You don’t need to create or edit mod_jk.conf. Click here for a
sample mod_jk.conf file generated automatically by tomcat on each startup.
Create a file in CATALINA_HOME/conf/jk called workers.properties. That file
should look like this:
# BEGIN workers.properties
worker.list=ajp13
worker.ajp13.port=8009
# change this line to match apache ServerName and Host name in server.xml
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
# END workers.properties
Startup tomcat: $CATALINA_HOME/bin/startup.sh
Wait at least 10 seconds for tomcat to finish. Start
apache: /usr/local/apache2/bin/apachectl start
Verify examples at http://localhost:8080/examples. On success, tomcat is
working correctly.
Verify examples at http://localhost/examples. On success, apache is working
correctly, and JSP and servlet requests are being passed to tomcat.
Back To Menu
Please send comments, suggestions, or changes to john AT johnturner DOT
com. Be advised that I will be happy to help where I can, but I am not available for
free one-on-one tech support to the whole world. 🙂
Copyright © 2002 John Turner. All rights reserved.
work music