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:
|
1 |
# 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):
|
1 2 3 4 |
# 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:
|
1 2 3 4 5 6 |
# 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:
|
1 |
# 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:
|
1 2 3 4 |
# 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.
|
1 |
# 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:
|
1 |
# /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!



5 Responses to “HOW-TO: Install Apache Tomcat 6 on FreeBSD 8.0”