Setup WebObjects 5.2.3 on  FreeBSD 4.10 current or FreeBSD 5.3 release (i386)
Rev 0.4 2004-11-25
Francois BIENTZ (francois.bientz@voila.fr)

Document based on the How-to :Setup WebObjects on Linux (Stefan Apelt) : http://www.tetlabors.de/wo/setup_webobjects_on_linux.html.
Other platforms http://www.tetlabors.de/wo/


Installed packages :
Linux_base
Apache 1.3.x
javavmwrapper
zip23
urw-fonts
compat 4x-i386

1.Install the JDK 1.4.2p6_6

get
- bsd-jdk14-patches-6.tar.gz (1MB)
- j2sdk-1_4_2-src-scsl.zip (2.5 MB)
- j2sdk-1_4_2-bin-scsl.zip (49 MB)
- j2sdk-1_4_2_05-linux-i586.bin (36MB)
put this files in /usr/ports/distfiles

add this line into /etc/fstab :
linproc /compat/linux/proc  linprocfs rw 0 0
reboot or type : mount -t linprocfs linprocfs /compat/linux/proc

Install the SUN JDKfor Linux :
cd /usr/ports/java/linux-sun-jdk14
make install clean

Install the native JDK:
cd /usr/ports/java/jdk14
make install clean
(it take a long time to compile ...)

create a link :
ln -s /usr/local/jdk1.4.2/bin/java /usr/sbin/java



2. Install WebObjects 5.2 Deployement for Solaris

Mount cd WO5.2 installation disk:
mount_cd9660 -g -j -r /dev/acd0c /cdrom (FreeBSD 4.10)
mount_cd9660 -g -j -r /dev/acd0 /cdrom (FreeBSD 5.3)

cd /cdrom/Deployment/SOLARIS
./install.sh -license B-111-AAA-111-AAA-111-AAA-111-AAA-111 -altjvm /usr/local/bin/javavm -adaptorsOnly NO -minimalInstall NO -cgibin /usr/local/www/cgi-bin -docroot /usr/local/www/data -woroot /usr/local/apple -gnutar /usr/bin/tar

On the question "Continue with unsupported installation ? (y/ [N]/q) :" reply y
On the question "Please make your selection ([R]/a/q) :" reply a

edit /etc/profile and add :
NEXT_ROOT=/usr/local/apple
export NEXT_ROOT
OS= FREEBSD
export OS

log off an log in (with a user login) then su


3. Install WebObjects 5.2  updates 5.2.1, 5.2.2, 5.2.3

get WO521Solaris.TAR.Z, WO522Solaris.TAR.Z,  WO523Solaris.tar.gzip and patcher.sh from Apple Support
Put these four  downloaded files  in /usr/ports/distfiles
cd /usr/ports/distfiles
chmod 511 patcher.sh
./patcher.sh -install WO51Solaris521.TAR.Z
./patcher.sh -install WO51Solaris522.TAR.Z
./patcher.sh -install WO51Solaris522.tar.gzip


4. Compile the Apache adaptor for FreeBSD

Open the file $NEXT_ROOT/Developer/Examples/WebObjects/Source/Adaptors/make.config with an editor of your choice and insert (copy and paste) the following lines right before the MacOS X entry (around line 17):

# FREEBSD
ifeq "FREEBSD" "$(OS)"
ADAPTORS = CGI Apache
# Default path for apxs
APXS = /usr/local/sbin/apxs
endif

Save and exit. Then cd  $NEXT_ROOT/Developer/Examples/WebObjects/Source/Adaptors/Apache/ :
mv Makefile Makefile.orig
touch Makefile
copy the text inside the ***** into Makefile

******* Makefile *********
include ../make.config
include ../Adaptor/make.preamble

# Common compiler and linker flags
CFLAGS = -O2 -Wall -I../Adaptor ${DEBUG_FLAG} -DSINGLE_THREADED_ADAPTOR -D${OS} -DFORKING_WEBSERVER -DAPACHE ${ENABLE_SSL_SUPPORT}

ifeq "MACOS" "${OS}"
# Flags for use when enabling mod_ssl support
ENABLE_SSL_SUPPORT = -DAPACHE_SECURITY_ENABLED
# These should be set to point at the ssl include and lib directories, respectively.
OPENSSL_INCL_FLAGS = -I/usr/local/include/openssl
OPENSSL_LIB_FLAGS = -L/usr/lib -lcrypto -lssl

LDFLAGS +=${OPENSSL_LIB_FLAGS}
STRIP_FLAGS = -S
endif

ifeq "SOLARIS" "${OS}"
# Flags for use when enabling mod_ssl support
ENABLE_SSL_SUPPORT =
# These should be set to point at the ssl include and lib directories, respectively.
OPENSSL_INCL_FLAGS =
OPENSSL_LIB_FLAGS =

# If Apache is in a nonstandard location, change this
APACHE_INCL_FLAGS = -I/usr/apache/include

CFLAGS +=-DEAPI ${APACHE_INCL_FLAGS}
LDFLAGS +=-G -L/lib -lsocket -lnsl ${OPENSSL_LIB_FLAGS}
endif
#
ifeq "FREEBSD" "${OS}"
ENABLE_SSL_SUPPORT =
OPENSSL_INCL_FLAGS =
OPENSSL_LIB_FLAGS =
APACHE_INCL_FLAGS = -I/usr/local/include/apache
CFLAGS +=-DEAPI ${APACHE_INCL_FLAGS}
LDFLAGS += -G -L/lib -lc ${OPENSSL_LIB_FLAGS}
endif

CFLAGS += ${OPENSSL_INCL_FLAGS}
APXSFLAGS = -i


all: mod_WebObjects.so

mod_WebObjects.so : mod_WebObjects.o ${COMMON_OBJFILES}
    ld ${LDFLAGS} mod_WebObjects.o  ${COMMON_OBJFILES} -o mod_WebObjects.so
    ${APXS} ${APXSFLAGS} mod_WebObjects.so

mod_WebObjects.o : mod_WebObjects.c ${COMMON_OBJFILES}
    ${CC} -c ${CFLAGS} mod_WebObjects.c  ${COMMON_OBJFILES}

clean:
    rm -f mod_WebObjects.so mod_WebObjects.o  *.o

include ../Adaptor/make.postamble
*******End  Makefile *********
Attention the lines :
    ld ${LDFLAGS} mod_WebObjects.o  ${COMMON_OBJFILES} -o mod_WebObjects.so
    ${APXS} ${APXSFLAGS} mod_WebObjects.so
          ${CC} -c ${CFLAGS} mod_WebObjects.c  ${COMMON_OBJFILES}
    rm -f mod_WebObjects.so mod_WebObjects.o  *.o
Must begin with <TAB> not spaces

The last file to change is $NEXT_ROOT/Developer/Examples/WebObjects/Source/Adaptors/Adaptor/appcfg.c. Search for the following three lines, starting around line 52:

#ifndef MAXPATHLEN
#define MAXPATHLEN 255
#endif

Cut-and-paste these three lines _after_ the following lines (around line 72), like so:

#include <arpa/inet.h> /* inet_addr() */
#include <sys/param.h>
#endif

#ifndef MAXPATHLEN
#define MAXPATHLEN 255
#endif

After applying these changes, do the following:
You must use gmake, so rename make :
cd /usr/bin
mv make make.orig
create a link:
ln -s /usr/local/bin/gmake /usr/bin/make

cd $NEXT_ROOT/Developer/Examples/WebObjects/Source/Adaptors
make clean; make
Rename your make :
cd /usr/bin
rm make
mv make make.orig make

During the compilation process, mod_WebObjects.so is automatically placed into /usr/local/libexec/apache, there is no need to do this by hand. If you find mod_WebObjects.so there, compilation was successful. The CGI adaptor has been built, too and can be found at $NEXT_ROOT/Developer/Examples/WebObjects/Source/Adaptors/CGI/WebObjects, if you want to play around with that.


5. Configure Apache for WebObjects

Copy the configuration file for WebObjects to the Apache conf folder:

cd $NEXT_ROOT/Developer/Examples/WebObjects/Source/Adaptors/Apache
cp apache.conf /usr/local/etc/apache/webobjects.conf

Edit /usr/local/etc/apache/httpd.conf. Search for the line "LoadModule rewrite_module ..." and insert the following lines right _before_ it:

Include /usr/local/etc/apache/webobjects.conf
<Location /cgi-bin/./>
SetHandler WebObjects
</Location>

Search for the line  "AddModule mod_rewrite.c" and put the following line right _after_ that:

AddModule mod_WebObjects.c

Search for a line "ServerName ..." and put your DNS host name in there. If you do not have one, you can use your IP adress, too. The explanation within httpd.conf about this is very good.

ServerName yourhost.yourdomain.com

Now edit /usr/local/etc/apache/webobjects.conf:

line 4: replace SYSTEM_LIBRARY_DIR/WebObjects/Adaptors/Apache/mod_WebObjects.so
with /usr/local/libexec/apache/mod_WebObjects.so

line 5: put a # in front of AddModule mod_WebObjects.c to comment it out

line 9: replace LOCAL_LIBRARY_DIR/WebServer/Documents with /usr/local/www/data

Optionally, you can change the following:

line 13: /cgi-bin/WebObjects (can be changed to /myFunkyAlias/WebObjects)

line 28: http://localhost:1085 10 (can be changed to http://host1:1085,http://host2:1085 10, don't put spaces after the comma sign when adding multiple hosts!)

Save and exit. Now, to see if everything is right, try:

/usr/local/sbin/apachectl configtest

If it says "Syntax OK", you are fine. Else, try to find and correct the errors it reports.


6. Start Apache and WO Services

Start Apache:
/usr/local/sbin/apachectl start

Start wotaskd :
$NEXT_ROOT/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &


7. Start JavaMonitor and test the installation

The last step before adding application is starting JavaMonitor and see if it works:
$NEXT_ROOT/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789

After JavaMonitor is launched, you will see a line similiar to the following:

Your application's URL is:
http://yourhost.yourdomain.com:56789/cgi-bin/WebObjects/JavaMonitor.woa

Open this URL in a web browser.