On a recent whim, I decided to spend a Saturday morning attempting to install Apache Tomcat 6 on FreeBSD 8.0. It turned out that it’s not as straightforward as some GNU/Linux distros*; particularly those that are Debian-based. Through some trial and error, though, I got things working as I liked.
*It also turns out that I still hate non-free software, or software that comes with restrictions, which is probably why I drifted away from java more than 8 years ago.
About the environment
Since this was an experiment, I simply spun up a VirtualBox VM on my Debian workstation, and allocated 1 CPU, 512MB RAM, and 8GB of hard drive space — FreeBSD is famously small, light, secure, and fast. You can download the latest FreeBSD here.
Installing Diablo JDK 1.6 on FreeBSD 8.0
Before you get started, make sure you have root access and an up-to-date ports collection.
Install some prereqs:
# pkg_add -r libXi libXp libXt libXtst
Or … if you’re a purist, compile them (but there’s not much need for libs like this … the packages are perfectly fine, IMO):
# cd /usr/ports/x11/libXi/ && make install clean # cd /usr/ports/x11/libXp/ && make install clean # cd /usr/ports/x11-toolkits/libXt/ && make install clean # cd /usr/ports/x11/libXtst/ && make install clean
At this point, you’ll need to do a little legwork. Namely: accept the Sun license to download the binaries. One could do this from the FreeBSD box, but it being a headless VM, things are easier with the browser on the host workstation. Go to The FreeBSD Foundation and download the appropriate package for your architecture. In my case, it’s diablo-jdk-freebsd7.i386.1.6.0.07.02.tbz. (Yes, I know it’s for FreeBSD 7, but it works just fine on 8.0 …)
Optional: if you intend to config the JDK to update the timezone data (enabled by default) you’ll also need the tzupdater from Sun. Go here to download.
Now, to get the files into the FreeBSD VM and put them where the port expects them. Using SFTP:
# sftp [your username]@[IP of machine where you downloaded the files] sftp> get diablo-jdk-freebsd7.i386.1.6.0.07.02.tbz sftp> get tzupdater-1_3_18-2009k.zip sftp> quit # mv diablo-jdk-freebsd7.i386.1.6.0.07.02.tbz /usr/ports/distfiles # mv tzupdater-1_3_18-2009k.zip /usr/ports/distfiles
If anything in the preceding steps was unclear, the make tool will quickly tell you what is missing and clarify for you. Compile the Diablo JDK:
# cd /usr/ports/java/diablo-jdk16/ && make install clean
If make complains about files needing to be in /usr/ports/distfiles, retrace the instructions it gives you. They will look very familiar …
If all goes well, test the JDK install. Log out and then back in again (relog), and check the java version:
# java -version java version "1.6.0_07" Diablo Java(TM) SE Runtime Environment (build 1.6.0_07-b02) Diablo Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)
Installing Apache Tomcat 6 on FreeBSD 8.0
It couldn’t get much easier.
# cd /usr/ports/www/tomcat6/ && make install clean
It’s a short install and you should notice that all of the dependencies are automatically discovered for you, most notably /usr/local/diablo-jdk1.6.0. To test that things are working:
# /usr/local/apache-tomcat-6.0/bin/startup.sh
Finally, point a browser at http://[Tomcat Server IP]:8180/, in my case, it’s http://192.168.0.153:8180/.
Of course, if you want to create a startup script in rc.d, I suspect you already know how :) I hope this helps. Cheers!



[...] IV HOW-TO: Install Apache Tomcat 6 on FreeBSD 8.0 Calebscreek writes: On a recent whim, I decided to spend a Saturday morning attempting to install Apache Tomcat 6 on FreeBSD 8.0. It turned out that it’s not as straightforward as some GNU/Linux distros*; particularly those that are Debian-based. Through some trial and error, though, I got things working as I liked. Step-by-step guide: Install Apache Tomcat 6 on FreeBSD 8.0 [...]
Yes, it helped. Thanks. I don’t have the /usr/ports installed (seems like a tremendous waste of bandwidth). So I only download source when I need to. Your step-by-step instructions made it much easier.
This art was very helpful for me at work. Unfortunately I have no idea how to create a startup script in rc.d. Could you describe this part too?
Having setup tomcat7 on FreeBSD 8.1 today, I didn’t see a need to create my own rc.d script. The port installed one in /usr/local/etc/rc.d for me. To run tomcat automatically, I just needed to add tomcat7_enable=”YES” to /etc/rc.conf as usual.
I had to download an older version of the tzupdater tool from Sun (Oracle’s) site. Use this URL to download the older version:
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/DownloadSingleSoftware-Start?ProductRef=tzupdater-1.3.34-oth-JPR_Multi-language_with_Generic%40CDS-CDS_Developer