tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Woolley <nick.wool...@virgin.net>
Subject Installing Tomcat4.0.1 on Mandrake 8.0
Date Wed, 14 Nov 2001 15:56:39 GMT

Hi,


I've been documenting my installation of Tomcat 4 on Mandrake Linux 8.0. 
  For what it's worth I'm posting this here.

It's a draft, and intended ultimately to contribute to a user's 
installation guide for the Melati package (www.melati.org, which 
requires a servlet container).  As such, I'm trying not to assume that 
the reader has a lot of unix knowledge. Plus, I have only addressed 
installing the RPMs at this point.

I would appreciate any additions, comments or corrections anyone would 
like to submit, and hopefully these can be incorporated.

Certain points exist which I think need to be followed up - I've 
labelled these with the tag 'FIXME'.  Notably:

* There is a problem with the mod_webapp RPM, which misconfigures 
Apache.  This wasn't fixed when I downloaded it a couple of days ago.

* There is also a small problem with the Tomcat RPM creating the Tomcat 
user with a nonexistant home directory.

I'm aware that some of the problems I list here may have been dealt with 
elsewhere on this list and have not been incorporated.  I've has some 
difficulty reading postings on the mailinglist archives at

http://www.mail-archive.com/tomcat-user@jakarta.apache.org/

When trying to open a post, I often (but intermittently) get errors like 
this:

Not Found The requested URL 
/tomcat-user@jakarta.apache.org/msg36559.html was not found on this server.



Nick

======================================================================

Installing Tomcat 4.0.1
=======================

This starts from the assumtion you have a system broadly like mine,
which is Mandrake 8.0 (although not a fresh installation, it has had
various patches and installs added).

This should apply also to other RedHat derived distributions.

The install was on a Pentium III, 9GB disk space, 312MB RAM (Compaq
M300 Armada laptop)

My system Apache already installed, either from the installation CDs,
or from the Mandrake updates (see any Mandrake ftp mirror) - security
patches up to November 2001 have been applied.  The updates shouldn't
be a requirement for you to get Tomcat working however.

apache-1.3.20-1.2mdk
apache-mod_perl-1.3.20_1.25_01-2.2mdk
apache-devel-1.3.20-1.2mdk
apache-modules-1.3.20-1.2mdk
apache-suexec-1.3.20-1.2mdk
apache-conf-1.3.20-1.2mdk
apache-common-1.3.20-1.2mdk

Apache should work okay out of the box.


Note, I assume you have root access.  Most of the steps following
assume that you a have root access, and a terminal window in which you
have logged on as root.  I also assume you are using the bash shell
(which is the default), and you know how to install an RPM package
with rpm (rpm -i <packagename> - see the manpage for more details).

I indicate commands typed on the root console with prompts like this

 > echo hello I am root
hello I am root
 > id
uid=0(root) gid=0(root) 
groups=0(root),10(wheel),6(disk),4(adm),3(sys),2(daemon),1(bin)

Occaisionally, I'll need to indicate that you need to insert whatever
is appropriate on your system - I'll sustitute labels enclosed in
andle brackets for these, <like this>.

For example:

 > cd <your download directory>

----------------------------------------------------------------------

1) Download an RPM package for the Java 2 platform standard edition
(newest currently v1.3).

You can do this from Sun, here:
http://java.sun.com/j2se/1.3/

At the time of writing this is j2sdk-1_3_1_01-linux-i386-rpm.bin

Or, from IBM here:
http://www-106.ibm.com/developerworks/java/jdk/linux130/

(IBM calls the the "Linux Developer Kit" - at the time of writing, it
  is IBMJava2-SDK-1.3-10.0.i386.rpm)

There is an option to download the double-byte fonts for Linux as well
- but these are I think only required if you'll be using non-western
character sets.

Also, registration is required in the case of IBM.

As for the difference, I cannot speak personally since I've not
actually compared the two, but I hear that the IBM implementation is
faster.  Hence that is the one I installed. FIXME Comments?


Install using rpm:

    > su
    > cd <download directory>
    > rpm -i IBMJava2-SDK-1.3-10.0.i386.rpm

In Sun's case you need to run the .bin file to get a rpm first:

    > su
    > cd <download directory>
    > sh ./j2sdk-1_3_1_01-linux-i386-rpm.bin
    > rpm -i j2sdk-1_3_1_01-linux-i386-rpm


----------------------------------------------------------------------

2) You may like to download Sun's development environment, Forte from:

http://www.sun.com/forte/ffj/buy.html

- the "Community edition" is free, and comes as an RPM.

There is also JBuilder, which is not free I think.  IBM's development
environment is Visual Age Java - also not free.  I can't comment about
the merits, relative or otherwise, of these packages.

If you don't mind the text-editor-and command-line route, then the
Mandrake 8.0 CDs contain packages for various editors: nedit, pico,
jed, KEdit, Emacs, vi, etc.


----------------------------------------------------------------------

3) Install JSSE (and possibly JNDI)

Note, the TOMCAT4.README.RPM documentation file installed with Tomcat
(in /usr/doc/tomcat4-4.0.1/) says:

"Tomcat 4.0 REQUIRE others packages installed :

      * JSSE (at least 1.0.2)
      * JNDI (present in JDK 1.2.x)"

The former can be obtained from http://java.sun.com/products/jsse
(registration required), and but is integrated with JSDK 1.4 (beta) and
higher.  At the time of writing, this is jsse-1_0_2-gl.zip

The latter is avaialble from here
http://java.sun.com/products/jndi/index.html

- although JNDI 1.2 is apparently already part part of the Java 2 SDK,
Standard Edition, v1.3.1 and 1.2, so if you installed one of the
packages above you don't need to install it.  There are "booster
packs" available for the LDP server, but they're not mandatory for
Tomcat.


To install these, unzip them somewhere, such as /usr/local/

 > cd /usr/local/
 > unzip <path to zipfile>/jsse-1_0_2-gl.zip

It's also sensible to set the ownership and access permissions with
zip or tar distributions, since they may be created with inappropriate
values for your system:

 > chmod -R go-w jsse1.0.2
 > chown -R root:root jsse1.0.2

FIXME I didn't do this, and Tomcat nominally works, but there are I
noticed there are various extra steps in the INSTALL.txt document in
the jsse zipfile.  You might want to follow them, and possibly they 
should be incorporated here at some point.

Likewise, follow these steps with JNDI, if you install it.

I put in a few symbolic links for convenience:

 > ln -s /opt/IBMJava2-13 /usr/java
 > ln -s <wherever you unzipped jsse>/jsse1.0.2 /usr/java/jsse

To install JSSE as a java extension, you need to copy or link these
files into the java JDK tree:

 > cp /usr/java/jsse/lib/*.jar /usr/java/jdk/jre/lib/ext

I also followed the advice in the TOMCAT4.README.RPM file and added
jsse's .jars to my global $CLASSPATH environment variable. The
following lines in /etc/profile do this (and set up a few other things
for Tomcat in advance).

export JAVA_HOME=/usr/java/jdk
export TOMCAT_HOME=/usr/java/tomcat
export CATALINA_HOME=/var/tomcat4
export PATH=$PATH:/usr/java/jdk/bin
export JSSE_HOME=/usr/java/jsse

export CLASSPATH=\
$JAVA_HOME/jre/lib:\
$JAVA_HOME/jre/lib/ext/
$JAVA_HOME/jre/lib/ext/jnet.jar:\
$JAVA_HOME/jre/lib/ext/jsse.jar:\
/usr/lib/pgsql/jdbc7.0-1.2.jar:\



----------------------------------------------------------------------

4) Install Tomcat - v4.02 is the latest version, available from

http://jakarta.apache.org/site/binindex.html

If you have a Red Hat compatible system like Mandrake, use the RPM
packages - this makes installtion (almost) trivial.  You need:

    tomcat4-4.0-1.noarch.rpm         <- essential
    tomcat4-manual-4.0-1.noarch.rpm  <- optional
    tomcat4-webapps-4.0-1.noarch.rpm <- examples etc. - advisable.

Tomcat 3.2.3 wasn't available as an RPM, and I had to write my own
/etc/init.d/tomcat script to start and stop the daemon, and edit the
apache configs, which was a pain.  Tomcat 4 comes an init script of
its own, and the RPM does most of the necessary configuration -
hooray!  It doesn't however, have any facility for autogenerating the
confuguration directives for proxying Tomcat under Apache, as Tomcat 3
did.

After installing the tomcat RPMs, you need to:

a) edit the variables in /etc/tomcat4/conf/tomcat4.conf (to point to
your java home directory, etc.)

b) set Tomcat to start automatically on runlevels 3 4 and 5 like this
(on RedHat-derived systems):

    > /usr/sbin/chkconfig --add tomcat

This defaults to configuring Tomcat to start in runlevels 3 4 and 5.

c) I notice that a Tomcat user and a group is created. The username s 
tomcat4, and has a home directory /var/tomcat.  This doesn't seem to 
have been created by the RPM, which installs most of Tomcat under 
/var/tomcat4.  Since I don't know if the username has been used 
explicitly in the tomcat scripts somewhere, I decided the safest fix to 
this is to as a symbolic link:

 > ln -s /var/tomcat4 /var/tomcat

FIXME this is a bug in the tomcat RPM.


If you don't have a RedHat compatible system, you may have to use the
tarballed version.  Presumably on systems which have RPM support but
don't have the same rc init script scheme will have to add a line like
this somewhere in their /etc/rc* scripts to get Tomcat to start on boot:

/etc/init.d/tomcat4 start

and this line in the shutdown script:

/etc/init.d/tomcat4 stop

(if you installed the RPM - if you installed the tarball, the init
script for Tomcat may be $CATALINA_HOME/bin/startup.sh and
$CATALINA_HOME/bin/shutdown.sh)


In theory that's all you need to do to use Tomcat as a stand-alone
webserver.

You can now test your installation.  As it stands, the server.xml file
in $TOMCAT_HOME/conf sets up various example servers listening on ports
8005, 8008, 8109, 8180, 8200.

The visiting http://localhost:8180/ accesses the stand-alone server
and should get the Tomcat default welcome page if the install has gone
well. This is obtained directly from Tomcat, without involving apache
- Apache doesn't even need to be running.

[Note, in my installation it seems that the images on this page were
corrupted - replacing them with the equivalents from Tomcat 3.2.3
demonstrated this was not a problem with Tomcat per se].

You can also try
http://localhost:8180/examples/servlets/index.html

All these example servlets should work.

One word of warning:  the init script spawns Tomcat as a child
process, and generally returns before Tomcat is entirely configured
itself.  This can cause problems, especially when restarting Tomcat -
after stopping Tomcat, always wait for lines:

Stopping service Tomcat-Standalone
Stopping service Tomcat-Apache

to appear in the catalina.out logfile in /var/tomcat4/logs, before you
start Tomcat again.  You can also check that Tomcat has stopped with

 > ps -ax | grep tomcat

Tomcat, if it is running, manifests itself as java processes like this:

/usr/java/jdk/jre/bin/exe/java -classpath /var/tomcat ...

If you start tomcat too quickly, the ports will still be used by the
old daemon, and you'll get error like this in your catalina.out
logfile:

Catalina.start: LifecycleException:  null.open:  java.net.BindException:
Address already in use


If Tomcat doesn't work, and it's not the above problem, check that
nothing else is using this port (use nmap and/or netstat), that there
are no left over directives included in your apache httpd.conf file
(which configure Apache to use Tomcat as a proxy), and that the Tomcat
server is running properly.  Look in the logs in $TOMCAT_HOME/logs.

I listed the steps I made testing my misbehaving Tomcat installation
in "Testing Tomcat".

Once this works, you can modify server.xml to have Tomcat listen on the
port(s) of your choice.  The Tomcat site suggests 8080, but this may be
used already by another service, such as an http proxy (squid, for
example).  The default configuration with the RPM has a stand-alone
Tomcat server on 8180, and a server designed to operate through
Apache on 8008 - as TOMCAT4.README.RPM says:

o Tomcat 4.0 will listen on port 8180 (HTTP 1.1), 8181 (HTTP 1.0),
   8543 (HTTP SSL) to avoid collision with running TC 3.x


----------------------------------------------------------------------

5) Installing mod_webapp

mod_webapp is needed if you're going to use Tomcat only for Servlets,
and Apache for normal web serving.  It allows Apache to delegate
certain URLs to Tomcat.

For more info about mod_webapp see:
http://tomcat.mslinn.com/tomcat/4.x/connectors/docs/apache-1.3.html

Also, there are messageboards where you can search for advice on
www.jguru.com.


You'll need to download the following RPM (available from the same
place as the Tomcat RPMs):

mod_webapp-1.0-1.i386.rpm        <- needed to use Tomcat with apache

If you've installed mod_webapp, then Apache *should* delegate requests
for the URL

http://localhost/examples/servlets/index.html

However, there seems to be a mistake in the mod_webapp RPM - I got an
error when I restarted Apache:

Starting httpd:
Syntax error on line 259 of /etc/httpd/conf/httpd.conf:
Invalid command 'WebAppMount', perhaps mis-spelled or defined by a
module not included in the server configuration
                                                              [FAILED]

After some research, it seems there are two problems with this.  Thie
first is that the WebAppMount command should be WebAppDeploy.  Fixing
this I got another error,

"Syntax error on line 260 of /etc/httpd/conf/httpd.conf:
Invalid virtual host name"

I found a number of suggestions top fixing this on the web
a) change the line

WebAppConnection warpConnection warp localhost:8180

to use the full name of your host (i.e myname.mydomain.mytld).

b) Add <VirtualHost localhost> directives around the WebAppDeploy
directives like this:

<IfModule mod_webapp.c>
       WebAppConnection warpConnection warp localhost:8180
<VirtualHost localhost>
      DocumentRoot
      ServerName localhost
      WebAppDeploy examples warpConnection /examples/
</VirtualHost>
</IfModule>

c) Set add ServerName directive (and possibly the Port directive) before
the WebAppConnection directive:

ServerName localhost
Port 80


For me, c) seemed to work, in fact I found a commented ServerName
directive in the httpd.conf file already, I just uncommented it.  I
don't think I broke anything doing this, although I'm not sure yet.

FIXME comments? update this later. later: no probs yet.


Another problem I experienced was a failure of Tomcat and Apache to
communicate via mod_webapp. This manifested itself by an error on
visiting http://localhost/examples/servlets/

WebApp: Error 404(File: wa_request.c Line: 197)
    Web-application not yet deployed


This is also due to the init script spawining Tomcat and returning
before it finishes initialising: basically, if you start Apache too
soon after the initscript, the connection between them won't be
configured correctly.

i.e. This often fails, if executed in quick succession:

 > /etc/init.d/tomcat4 start
 > /etc/init.d/httpd start

A consequence of this is that Tomcat may not be working properly when
you start your machine, if the daemon is configured to start
automatically.

FIXME I don't know of a solution for this yet.  You'll have to start
Tomcat and Apache manually.

Note - if you start Tomcat manually, Apache should aways be started
*after* Tomcat, otherwise the "warp" connection between them will not
get configured.

Once Tomcat and apache are working, all the examples should be
accessable under :

http://localhost/examples/servlets.


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message