aspose file tools*
The moose likes Linux / UNIX and the fly likes Installing Tomcat on Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Installing Tomcat on Linux" Watch "Installing Tomcat on Linux" New topic
Author

Installing Tomcat on Linux

Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Please excuse me if this question is in the wrong place but I think it's a Linux question more than anything else so I think belongs here.

I am going to be installing Tomcat on a Linux server (Redhat Enterprise Linux 3ES) and I am just wondering if anyone has a link to a good step by step guide on doing this.

I ask because while I am not totally clueless on Linux I do find that everything that should take 10 minutes takes me 3 days because of some gotcha that isn't well documented and it's all very frustrating.

I have looked at http://tomcat.apache.org/tomcat-5.5-doc/setup.html but it is less then comprehensive in my opinion. It looks like it should be so simple yet when I see make I panic because I know that means I will spend a day trying to figure out why it can't find all the bits it thinks it should be able to find.

So before I get myself all into a mental vapor lock state I was hoping someone knows of a good resource to again maybe offer a step by step guide on getting Tomcat installed correctly and safely on Linux.
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Christmas Crackers! There's a Tomcat forum. Sorry. Maybe this question is better there... I don't know.
S Dongan
Greenhorn

Joined: Sep 17, 2005
Posts: 18
Hi,

Just upload the tomcat files in the location/directory where to you want to install.

Untar the files.

set CATALINA_HOME and JAVA_HOME vaiable in shell

like

export JAVA_HOME="/usr/java/j2sdk1.4.2_10";
export CATALINA_HOME="/opt/jakarata-tomcat-4.1.31";


Regards,
Dongan
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

Originally posted by Maximilian Xavier Stocker:
Christmas Crackers! There's a Tomcat forum. Sorry. Maybe this question is better there... I don't know.


No, you did right. This is more an OS question than a purely Tomcat one.

The easiest way to install tomcat is to pick a directory and unzip/untar it. /opt and /usr/local are favorites, though for a test tomcat, your home directory is OK.

There are other ways, though. There should be a Tomcat RPM for Red Hat. The downside, however is that it may not be that up-to-date and (worse yet) it may coerce you into that horrible "alternatives" system.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Unzipping it is definitely most of the battle, but there's more. Do you want it to run as a dedicated "tomcat" user, and be launched by startup scripts when the machine boots? This isn't too hard, but the details vary by distribution. This is the kind of thing you get for free with a standard package for your particular flavor of Linux.

There is also the reserved port issue. On UNIX, the standard Web port 80 is "reserved" and only processes running as root can bind to it. For a C program, it's easy enough to start as root and then "demote yourself" to a less priveleged user. In Java, that can't be done, so you have to figure something out. On my machines, I use "iptables" to forward packets from an unprivileged port to port 80. Note that it's considered dangerous to run a public server process as root.

Then there's the really nasty issue of using Tomcat and Apache together. There is simply no easy way to do this, and no one who has done it successfully ever reports a better way. Lots of configuration on both ends, and compiling and assembling the appropriate bits and pieces. Bleah. Unless your site is huge, it's often best to just run the whole thing on Tomcat.


[Jess in Action][AskingGoodQuestions]
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Originally posted by Ernest Friedman-Hill:
Then there's the really nasty issue of using Tomcat and Apache together. There is simply no easy way to do this, and no one who has done it successfully ever reports a better way. Lots of configuration on both ends, and compiling and assembling the appropriate bits and pieces. Bleah. Unless your site is huge, it's often best to just run the whole thing on Tomcat.


The user stuff was bit of a concern as well but I think I can handle it... this part though was of MAJOR interest to me.

I blame myself (as I should) for not giving more details before but I am enourmously grateful for your mentioning this because this exactly what I was going to be attempting.

I have an existing Apache installation with numerous virtual sites and all the configuration for these sites. Over 2/3rds of these sites make heavy use of PHP.

I (obviously) erroneously assumed that I could configure Apache as follows.



So I guess I was wrong? There must be someway to do something as you don't say it's impossible.

I think my next step will be to repeatedly try things out on my development box although I find that's only so-so helpful because with out being valid for DNS reasons I can't test the vitual sites. Anyway we'll see.

Do you know of any articles/guides that discuss this type of setup? Am I totally lost? Can Tomcat be set up to process PHP as well? If I only had to move my virtual site configs over I could do that...
[ April 13, 2006: Message edited by: Maximilian Xavier Stocker ]
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
I feel like the man cleaning his rifle and with eye peering down the barrel hears a voice behind saying "Did you know the safety is off?"

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

It's not impossible, nor even rare; lots of people do it. It's just that's it's about as much fun and easy as stabbing yourself in the ear with a pencil held between your toes.

What you need is the Apache Jakarta Tomcat Connector. You need to use mod_jk. You need to use ajp1.3. You can use Apache 1 or 2. Read, read, read. Google, google, google. Take your time.
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Originally posted by Maximilian Xavier Stocker:

Do you know of any articles/guides that discuss this type of setup? Am I totally lost? Can Tomcat be set up to process PHP as well? If I only had to move my virtual site configs over I could do that...


Max, where are you at? Just a quick checklist:

Do you have java 5 installed? If so where?
Do you have Tomcat 5.5 installed? If so where?
I take it you haven't installed mod_jk yet is that so?

And no Tomcat doesn't do php (theoretically I believe it can) But why would you request something to apache that requests something to tomcat that requests something to php when apache can do it straight away?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Installing Tomcat on Linux