tomcat 5 with apache 1.x and jdk1.5 freebsd

tsiou

Verified User
Joined
Sep 15, 2006
Messages
236
Location
Larisa, Greece
This HOWTO has been taken from http://www.directadmin.com/forum/showthread.php?s=&threadid=2227&highlight=tomcat
and edited to match freesbd requirements.

You do not need to set up variables like JAVA_HOME etc, bsd does it for you.

All we need to install is
sdk
jakarta-tomcat5
mod_jk

So,

1. download the sdk by yourself and move it to /usr/ports/distfiles from :
http://www.FreeBSDFoundation.org/cg...ablo-caffe-freebsd6-i386-1.5.0_07-b01.tar.bz2
(this file is for freebsd 6.1, you can download the file that matches your distro.

2. do the following to install the packages (sdk is installed as depedency by the system)

cd /usr/ports
portinstall www/jakarta-tomcat5
portinstall mod_jk

3. Apache is also installed as a depedency and conf files are copied to bds default folders. So we move them to da's apache folder (do not deinstall apache, probably you 'll delete also da's binaries, just do not ever update the package)

cd /usr/local/etc/apache
cp workers.properties.sample mod_jk.conf.sample /usr/local/jakarta-tomcat5.0/conf
cd /etc/httpd/conf
cp -p /usr/local/libexec/apache/mod_jk.so ../modules

4. Be sure that bsd apache script never runs

cd /usr/local/etc/rc.d
mv apache.sh /root/backups (or something)

5. make and edit the conf files :

cd /usr/local/jakarta-tomcat5.0/conf
cp mod_jk.conf.sample mod_jk.conf
cp workers.properties.sample cp workers.properties

vi mod_jk.conf

----------------
LoadModule jk_module modules/mod_jk.so

JkWorkersFile "/usr/local/jakarta-tomcat5.0/conf/workers.properties"
JkLogFile "/usr/local/jakarta-tomcat5.0/logs/mod_jk.log"
JkLogLevel error

JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
JkMount /manager/* ajp13
JkMount /admin/* ajp13
-------------------

vi workers.properties

--------------------------
workers.tomcat_home=/usr/local/jakarta-tomcat5.0
workers.java_home=/usr/local/diablo-jdk1.5.0
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
----------------------------

edit server.xml and add a virtual host (the linux topic has everything about this)

6. edit /usr/local/etc/rc.d/tomcat50 start up script

vi /usr/local/etc/rc.d/tomcat50
change this line to be :
-----------------------
tomcat50_user="${tomcat50_user:-"apache"}"
-----------------------

7. edit /etc/rc.conf and add :

vi /etc/rc.conf
---------------------
tomcat50_enable="YES"
tomcat50_java_home="/usr/local/diablo-jdk1.5.0"
tomcat50_java_version="1.5.0"
---------------------

8. be sure folder /usr/local/jakarta-tomcat5.0 to have permissions/owner

----------------
drwxr-xr-x 3 root wheel 1024 Oct 17 16:00 bin
drwxr-xr-x 5 root wheel 512 Oct 17 16:00 common
drwxr-xr-x 3 apache apache 1024 Oct 20 12:12 conf
drwxr-xr-x 2 apache apache 512 Oct 19 14:13 logs
drwxr-xr-x 5 root wheel 512 Oct 17 16:00 server
drwxr-xr-x 4 root wheel 512 Oct 17 16:00 shared
drwxr-xr-x 2 apache apache 512 Oct 17 16:00 temp
drwxr-xr-x 8 root wheel 512 Oct 17 16:00 webapps
drwxr-xr-x 3 apache apache 512 Oct 17 18:04 work
--------------------------------------
(you can remove write permissions from apache)


9. start tomcat/apache

/usr/local/etc/rc.d/tomcat50 start
/usr/local/etc/rc.d/httpd restart

apache has this warning :

[Fri Oct 20 12:19:02 2006] [warn] Loaded DSO modules/mod_jk.so uses plain Apache 1.3 API, this module might crash under EAPI! (please recompile it with -DEAPI)

i'm trying to solve it.. although apache and tocat are up....
 
Back
Top