Installing Tomcat on Linux

You’ll find that installing Tomcat on Linux or Unix is easy. Download either the zipped file or the gzipped tar file if you have GNU gzip. Whatever your requirements, Tomcat is available from http://jakarta.apache.org/site/binindex.cgi. Choose the most stable version of Tomcat 5.0.x or Tomcat 5.5.x provided. The choice will largely depend on what version of Java you’re using. If you have JDK 5, then choose Tomcat 5.5.x; otherwise you can pick either, because Tomcat 5.5.x can be modified to work with earlier versions of Java (download the appropriate compatibility archive).

You should now export the $CATALINA_HOME environment variable, using the following commands:

 # CATALINA_HOME=/usr/java/jakarta-tomcat-5.x  # export CATALINA_HOME 

Alternatively, add these to ~/.bashrc or /etc/profile as you did for the JDK installation previously, or create a shell file, tomcat.sh, and place it in the /etc/profile.d. /etc/profile will run it automatically at startup to make the variable available to all users.

You can now start Tomcat by running the following shell command:

 # $CATALINA_HOME/bin/startup.sh 

You can shut down Tomcat using $CATALINA_HOME/bin/shutdown.sh.

If you’re using Tomcat 5.5.x and JDK 1.4, then extract the contents of jakarta-tomcat-5.5.x-compat.tar.gz to the same location as the Tomcat zipped file. You can see where to place the files in Figure 2-3. The Tomcat zipped file and the compatibility file have the same structure so that installation is simple.

Note 

All public Web servers run on port 80, which is the default HTTP port. When a browser attempts to connect to a Web site, it uses port 80 behind the scenes; that is, you don’t have to specify it. Tomcat’s HTTP service runs on port 8080 by default to avoid a clash with other Web servers that may already be running. Another reason is that Linux and Unix systems require a user to have root permission to assign port numbers below 1024 to a process. You’ll see how to change this in Chapter 4.

Viewing the Default Installation

To check that Tomcat is running, point your browser to http://localhost:8080. You should see a screen like the one in Figure 2-6.

To check that the dynamic side of Tomcat’s functionality is working, choose the JSP Examples link from the menu on the left and select some of the examples. Check that they run without error messages. Do the same with the Servlet Examples link to test this functionality.

If you have any problems, refer to the “Troubleshooting and Tips” section later in this chapter.



Pro Jakarta Tomcat 5
Pro Apache Tomcat 5/5.5 (Experts Voice in Java)
ISBN: 1590593316
EAN: 2147483647
Year: 2004
Pages: 94

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net