Installing Jakarta – Tomcat

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!

Speak Your Mind

*