Tomcat 6 on Debian Lenny

I need to install Tomcat 6 for a school assignment. I thought the installation process was easy as counting 123, but it turned out to be a few hours long of head scratching. Well, the first start is to setup a few environment variables as required by Tomcat:

CATALINA_BASE=/home/kenno/bin/apache-tomcat-6.0.13
CATALINA_HOME=/home/kenno/bin/apache-tomcat-6.0.13
export CATALINA_HOME;
export CATALINA_BASE# JAVA_HOME and Path to java, javac
JAVA_HOME=/usr/lib/j2sdk1.6-sun/bin
export JAVA_HOME;
export PATH=${JAVA_HOME}/bin:${PATH}:.

It can be stored in a setEnv.sh file, and run with source setEnv.sh to load those variables.

Then when I tried to run Tomcat with the following command, there was some error with the BASEDIR:

kenno@kampongcham:~$ $CATALINA_HOME/bin/startup.sh
The BASEDIR environment variable is not defined correctly
This environment variable is needed to run this program

I wasted a few hours trying to search for solutions on Google, and as when I was about to temporarily give up for dinner, I found an unexpected answer from one of the blogs.

“I need to set all the shell scripts in $CATALINA_HOME/bin to be executable”

So let’s fix it:

kenno@kampongcham:~$ cd $CATALINA_HOME/bin
kenno@kampongcham:~/bin/apache-tomcat-6.0.13/bin$ chmod +x *.sh

Finally, it’s done. We can now run tomcat without any errors:

kenno@kampongcham:~/bin/apache-tomcat-6.0.13/bin$ ./startup.sh
Using CATALINA_BASE:   /home/kenno/bin/apache-tomcat-6.0.13
Using CATALINA_HOME:   /home/kenno/bin/apache-tomcat-6.0.13
Using CATALINA_TMPDIR: /home/kenno/bin/apache-tomcat-6.0.13/temp
Using JRE_HOME:       /usr/lib/j2sdk1.6-sun/bin

That’s it folks. When you setup Tomcat on your machine, make sure you specify the correct path to all the variables mentioned above.

Thanks to Michael for the solution: Tomcat 6 on OSX

14 thoughts on “Tomcat 6 on Debian Lenny

  1. Melodie says:

    Well, I have tried all of the above and am still getting the error

    The BASEDIR environment variable is not defined correctly
    This environment variable is needed to run this program

    I am using Tomcat 5.5.27 on Linux Debian.

    I am also using su to the user that has rights.

    Thanks for any help as I am stumped!

    Melodie

  2. Thushara says:

    The BASEDIR environment variable is not defined correctly This environment variable is needed to run this program. it’s a permission issue. run bellow command

    cd $CATALINA_HOME/bin
    chmod u+x *

  3. Tomcat 6 is now in squeeze, and is included with ubuntu since 9.04, which means, you can install via packages in a way that’s coherent with the existing system. I’m not sure about the state of the dependencies but you might be able to install the squeeze packages on lenny without much fussing.

      • and fair enough, really, I can’t see much merit to it, unless you have something that already needs it… but when you need it, it’s a good thing indeed. but you have some google juice here, and now that lenny is stable, I just wanted to clarify…

  4. Lester says:

    Thanks for the tip. The bit about all the shell scripts being set needing to be executable really helped. I had switched startup.sh and catalina.sh but it wasn’t enough.

Leave a reply to Melodie Cancel reply