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!







HOW-TO: Change the default Thematic navigation bar to display categories instead of pages
So, I figured that tweaking the Thematic WordPress theme that I recently selected as the basis for my blog would present no challenge whatsoever. I mean, it’s PHP, right? Well, yeah, but …
The stumbling block
Child themes and the filter system. Period. I don’t think I’ve ever stumbled across a less-intuitive design. (Admittedly, this post is less about filters and more about hooks and actions, but filters bend the mind as soon as the average person encounters them.)
The author(s) of the theme have posted a fairly-useful guide to customization here, but there’s still a bit of grokking and head-scratching required if this is new to you. Of course, once you “get it”, it’s easy — just like most other abstract concepts. So, let’s dive right in assuming you have set up your child theme according to the example that Thematic provides, and you’ve activated it.
One foot in front of the other
First, you’ll need to create a custom function to remove (undo?) the default
thematic_access()action in thethematic_header()hook. Add this bit to your child theme’sfunctions.phpfile:// Remove the default page-level nav function remove_thematic_access($content) { remove_action('thematic_header', 'thematic_access', 9); } add_action('init', 'remove_thematic_access');If you were to save now and view your blog, you’d see that the navigation bar is missing entirely. Good. You’re half way there.
Now, it’s a matter of creating a custom action and inserting it into the
thematic_header()hook in the same position as the action you just removed (which is what that'9'is all about.) Add this to yourfunctions.phpfile:// Create category-level nav function custom_childtheme_access() { ?> <div id="access"> <div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div> <div class="menu"> <ul class="sf-menu sf-js-enabled"><?php wp_list_categories('title_li='); ?></ul> </div> </div><!-- #access --> <?php } add_action('thematic_header', 'custom_childtheme_access', 9);Save and voila. If you’re curious about some of those magick words, the Google machine is your best bet.
The finish line
Granted, there may be a more shorthand way to do this (e.g., the hardcoded CSS styles?), but this seems to work for me.
For more context, following is a tidbit from the authors’ wiki listing the available hooks and actions. As always, I hope this helps someone. Cheers!
The following theme hooks can be used to modify Thematic through your Child Theme functions.php file or even a custom plugin.
Theme Hooks
thematic_before()Located in header.php just after the opening body tag, before anything else.
thematic_aboveheader()Located in header.php just before the header div.
thematic_header()This hook builds the content of the header div and loads the following actions:
thematic_belowheader()Located in header.php just after the header div.
thematic_abovecomments()thematic_abovecommentslist()thematic_belowcommentslist()thematic_abovetrackbackslist()thematic_belowtrackbackslist()thematic_abovecommentsform()thematic_show_subscription_checkbox()thematic_belowcommentsform()thematic_show_manual_subscription_form()thematic_belowcomments()thematic_abovemainasides()thematic_betweenmainasides()thematic_belowmainasides()thematic_abovefooter()thematic_after()