Print View

Installing Jakarta - Tomcat
Updated: 03/10/2008


General Information

A straight forward manner to install the basic Jakarta - Tomcat server.

Requirements

  1. Minimal knowledge of FreeBSD and a minimal FreeBSD installation.
  2. Linux compatibility, wget and unzip have to be installed.
  3. Local or remote access to the box.
  4. You will need a web browser in order to sign the JDK agreement and download accordingly.

Installation

Download and unpack the latest Apache - Tomcat source from http://tomcat.apache.org/ in your home directory.
#
#
#
#
cd ~
wget http://apache.belnet.be/tomcat/tomcat-6/v6.0.14/src/apache-tomcat-6.0.14-src.tar.gz
tar xvzf apache-tomcat-6.0.14-src.tar.gz
cd apache-tomcat-6.0.14-src
Read the included BUILDING.txt.
This text file contains the steps we are going to take to successful install Jakarta – Tomcat.
# more BUILDING.txt
Following this instructions, we have to download and install the JDK first and Ant afterwards. Instead of following the provided link in the text file for downloading the JDK, we will use http://www.freebsdfoundation.org/downloads/java.shtml to download the needed JDK. Please select the Diablo JDK 1.5.0-7 package accordingly your architecture and follow the download procedure. Go to your download directory and add the package.
# pkg_add diablo-jdk-freebsd6.i386.1.5.0.07.01.tbz
The installation can complain about two missing packages: xorg-libraries-6.9.0 and javavmwrapper-2.0_6. We add the packages as follows or use their respectively ports and afterwards re-execute previous command.
#
#
pkg_add -r xorg-libraries
pkg_add -r javavmwrapper
You can safely ignore following notice after adding the diablo-jdk:
pkg_add: warning: package 'diablo-jdk-1.5.0.07.01' requires 'javavmwrapper-2.0_6', but 'javavmwrapper-2.3' is installed
Now we download apache-ant from http://ant.apache.org/bindownload.cgi and unpack it in /usr/local/apache-ant-1.7.0.  
#
#
#
#
#
cd ~
wget http://apache.scarlet.be/ant/binaries/apache-ant-1.7.0-bin.tar.gz
tar xzf apache-ant-1.7.0-bin.tar.gz
cp -r apache-ant-1.7.0/ /usr/local/
cd /usr/local/apache-ant-1.7.0
Before we can start building Tomcat, we have to set a few environment variables.
#
#
#
#
setenv ANT_HOME /usr/local/apache-ant-1.7.0
setenv JAVA_HOME /usr/local/diablo-jdk1.5.0
setenv PATH /sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin
:/usr/local/apache-ant-1.7.0/bin
We are ready to build Tomcat, first go to your Apache – Tomcat directory.
# cd ~/apache-tomcat-6.0.14-src
Now we have to execute ‘ant download’ and ‘ant’ in this directory. Although we followed the set environment instructions provided in the BUILDING.txt,  ‘ant’ won't do its thing at this point. We know better. Execute ‘ant’ as follows in the source directory of  Apache-Tomcat.
# /usr/local/apache-ant-1.7.0/bin/ant download
Probably you will get this build error:
testexist:
     [echo] Testing  for /usr/share/java/eclipse/plugins/org.eclipse.jdt.core_3.2.3.v_686_R32x.jar

downloadzip:
      [get] Getting: http://sunsite.informatik.rwth-aachen.de/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-JDT-3.2.2.zip
      [get] To: /usr/share/java/file.zip
      [get] Error opening connection java.io.FileNotFoundException: http://sunsite.informatik.rwth-aachen.de:3080/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-JDT-3.2.2.zip
      [get] Error opening connection java.io.FileNotFoundException: http://sunsite.informatik.rwth-aachen.de:3080/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-JDT-3.2.2.zip
      [get] Error opening connection java.io.FileNotFoundException: http://sunsite.informatik.rwth-aachen.de:3080/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-JDT-3.2.2.zip
      [get] Can't get http://sunsite.informatik.rwth-aachen.de/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-JDT-3.2.2.zip to /usr/share/java/file.zip

BUILD FAILED
/usr/home/phil/apache-tomcat-6.0.14-src/build.xml:680: The following error occurred while executing this line:
/usr/home/phil/apache-tomcat-6.0.14-src/build.xml:635: Can't get http://sunsite.informatik.rwth-aachen.de/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-JDT-3.2.2.zip to /usr/share/java/file.zip
Reading the BUILD FAILED paragraph implies the solution. We solve this as follows:
#
#
#
#
cd /usr/share/java
wget http://archive.eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-JDT-3.2.2.zip
unzip eclipse-JDT-3.2.2.zip
rm eclipse-JDT-3.2.2.zip
Go back to your Apache-Tomcat source directory and re-execute
# /usr/local/apache-ant-1.7.0/bin/ant download
Then, run
# /usr/local/apache-ant-1.7.0/bin/ant
When the build is successful, Apache-Tomcat is located in the output directory of the source directory. We copy the contents of ~/apache-tomcat-6.0.14-src/output/build to /usr/local/apache-tomcat-6.0.14. Then we have to make the shell scripts executable and finally set the server’s home environment.
#
#
#
cp –r output/build/ /usr/local/apache-tomcat-6.0.14
cd /usr/local/apache-tomcat-6.0.14/bin && chmod +x *
setenv CATALINA_HOME /usr/local/apache-tomcat-6.0.14
# ./startup.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.14/temp
Using JRE_HOME:       /usr/local/diablo-jdk1.5.0
touch: /usr/local/apache-tomcat-6.0.14/logs/catalina.out: No such file or directory
We notice, again, following the provided install instructions, will lead to some error.
#
#
#
cd /usr/local/apache-tomcat-6.0.14
mkdir logs
cd bin
# ./startup.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.14/temp
Using JRE_HOME:       /usr/local/diablo-jdk1.5.0
#
Now use your web browser and point to http://localhost:8080/ or if you installed Tomcat on another box, point to the respective web address.

Note:  For another web address as your local loop back, forward your port in your router.

Installing Jakarta – Tomcat can be a time waster and painful when you don’t have the time or the patience to install it. In my opinion the installation instruction is not newbie friendly and by this document I hope I can spare some pain.  When looking back on the installation process, it is like most installations in FreeBSD, child’s play.

That’s all folks!

This guide is © 2008 - 2009 philg.

Author: philg
demonjokerjr at hotmail dot com



3 Comments

Posted by teyeheimans on September 14, 2008 at 12:12:44 pm EEST

Thanks, this is really the best article I could find for installing tomcat!

Maybe you should also note that it's required to use Diablo JDK 1.5.0-7 instead of JDK 1.6, because Tomcat won't build with version 1.6.

Thanks again for this great article, you really made my day!


Posted by teyeheimans on September 15, 2008 at 8:59:44 pm EEST

Ow, btw, I had another problem:

fileserver2# cd ~/apache-tomcat-6.0.18-src
fileserver2# /usr/local/apache-ant-1.7.1/bin/ant download
/libexec/ld-elf.so.1: Shared object "libz.so.3" not found, required by "java"

After some searching on the internet I found that I had to install compat6x because I was using FreeBSD 7.

fileserver2# whereis compat6x
compat6x: /usr/ports/misc/compat6x
fileserver2# cd /usr/ports/misc/compat6x
fileserver2# make && make install && make clean

After this it worked like a charm!


Posted by teyeheimans on September 19, 2008 at 5:54:04 pm EEST

I noticed that Diablo JDK 1.5.0-7 is only needed for building tomcat, so if you want to use Diablo JDK 1.6.0-7 you can just pkg_delete the 1.5 version and install the 1.6 version.


Copyright 2003 - 2009 BSD Guides.  All rights reserved.

About | Terms of Use | Privacy | Contact