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

About these ads

14 thoughts on “Tomcat 6 on Debian Lenny

  1. kenno says:

    Glad this post is helpful. :)

  2. danny says:

    searched around google and found this post. THANKS! now i can eat lunch.

  3. kenno says:

    Enjoy your lunch. The last time I had this problem, I didn’t have dinner until I get it fixed too.

  4. Antonio says:

    Fine post, thank you. But as for me, I prefer not to hardcode . into PATH.

  5. 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

  6. 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 *

  7. jastazv says:

    That was good.

    Thank you. I was looking for something like that.

  8. tychoish says:

    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.

    • Kenno says:

      Thanks for the update @tychoish. I haven’t touched Tomcat since 2007, a few months after this post was written.

      • tycho says:

        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…

  9. Hey guys,

    If you guys are getting base dir error then please check the post under given on IT Operationz. Hope it will help you to solve your problem.

    http://www.itoperationz.com/2009/06/how-to-install-and-configure-apache-tomcat-6-on-debian-5/

    A startup script for tomcat is also included in that post.

  10. 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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: