Tutorial
Menus

Servlet - Servlet Basics

Deploying Servlet Using Tomcat

Rating: 4.7/5 (6 votes cast)

Level   : Beginners
Author : Arunkumar S
Download Source : Not Avaliable

Installing and Configuring Tomcat In Linux -Step by Step Configuration instructions

Installing to Linux - The installation is much simpler on a Linux than a Windows machine. The first thing you need to do is install the JDK. For our purposes, we will assume that the JDK will be installed to /root/java.

After you have the JDK installed, you need to set the JAVA_HOME environment variable. To do this under Linux, find your shell in Table 2 and type the matching command. You will need to replace /root/java with the root location of your JDK installation.

Java Environment Settings  bash shell 

           # JAVA_HOME=/root/java
           # export JAVA_HOME
   


You should add the location of the Java interpreter to your PATH environment variable.

You now need to extract the Tomcat server to a directory of your choosing. This directory will become the TOMCAT_HOME directory. For this installation, we will assume that Tomcat will be installed to /root/Tomcat6.0

The last step is to set the TOMCAT_HOME environment variable. To do this under Linux, find your shell in Table 3 and type the matching command. You will need to replace /bob with the name of the directory located directly above your Tomcat installation.

Tomcat Environment Settings Base Shell
   

             # TOMCAT_HOME = /root/Tomcat6.0
             # export  TOMCAT_HOME
   


Testing Your Tomcat Installation

To test the Tomcat installation, first start the Tomcat server. Table 4 contains the startup and shutdown commands for each OS.

Tomcat Startup/Shutdown Commands

Windows NT/2000/XP           
      

              TOMCAT_HOME\bin\startup.bat
              TOMCAT_HOME\bin\shutdown.bat
     ex:
              cd c:\tomcat6.0\bin
              c:\>tomcat6.0\bin\startup.bat
              c:\>tomcat6.0\bin\shutdown.bat

          
             
             

Linux  

         TOMCAT_HOME/bin/startup.sh   
         TOMCAT_HOME/bin/shutdown.sh

 ex:

        # cd  /root/tomcat6.0/bin
        [/root/tomcat6.0/bin]#  ./startup.sh
        [/root/tomcat6.0/bin ]#  ./shutdown.sh



Once Tomcat has started, point your browser at

http://localhost:8080/



You should see a page similar to Figure 5.

Screen shot.
Figure 5. The Tomcat Default Page

If you would like to have all requests serviced on the default HTTP port of 80, instead of port 8080, you will need to make the following change to the TOMCAT_HOME/conf/server.xml file and restart Tomcat.

Change

<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8080" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>

to

<!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="80" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>

Now point your browser at

http://localhost/

and you'll see results similar to those in Figure 5.



< Previous 1 | 2 | 3 |  Next >

Discussion about this tutorial

  Start a new Discussion | Read All Discussion
Subject RepliesLast Post
Javaorigin.com contact@javaorigin.com