How-I: Got Tomcat to run on Ubuntu 7.04 (Quick and Dirty)

Tomcat requires Java to be installed first. But I'm not gonna talk about that here(clearly out of the topic).

I installed tomcat5.5

$ sudo apt-get install tomcat5.5
$ sudo apt-get install tomcat5.5-webapps
$ sudo apt-get install tomcat5.5-admin


I got errors errors when I installed tomcat5.5-webapps and tomcat5.5-admin

...
Setting up tomcat5.5-webapps (5.5.20-4ubuntu1) ...
invoke-rc.d: initscript tomcat5.5, action "status" failed.
...
...
Setting up tomcat5.5-admin (5.5.20-4ubuntu1) ...
invoke-rc.d: initscript tomcat5.5, action "status" failed.
...


I found a fix taken from this site

$ cd /var/lib/tomcat5.5
$ sudo chown -R tomcat55 logs work
$ sudo chown tomcat55 /usr/share/tomcat5.5


Most HOW-TOs suggest you can start tomcat like the one below, but that didn't work in my set-up (no verbose errors popped-up but I couldn't access http://localhost:8180)

$sudo /etc/init.d/tomcat5.5


So, I searched for other alternatives. Fortunately, I stumbled upon this site which fixed everything.

$ sudo cd /usr/share/tomcat5.5/logs
$ sudo mv catalina.out catalina.out.orig
$ sudo touch catalina.out
$ sudo chown tomcat55:nogroup catalina.out


Then, as opposed to running Tomcat using the script in /etc/rc.d/tomcat5.5, I used startup.sh found in Tomcat's install directory

$ export JAVA_HOME=/usr/lib/j2sdk1.4-sun
$ sudo /usr/share/tomcat5.5/bin/startup.sh


This time I can access http://localhost:8180. Horray! I've just added more confusion to the already clobbered up Ubuntu documentation.