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:

export CATALINA_BASE# JAVA_HOME and Path to java, javac
export JAVA_HOME;
export PATH=${JAVA_HOME}/bin:${PATH}:.

It can be stored in a file, and run with source 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/
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$ ./
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!


  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.

    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 and but it wasn’t enough.

Leave a Reply

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

You are commenting using your 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


Get every new post delivered to your Inbox.

%d bloggers like this: