Install Tomcat on Linux

To install Tomcat on Windows on Linux:

  1. Go to the following URL:
  2. Select the tar.gz download.
    The apache-tomcat-6.0.x.tar.gz file is downloaded.
  3. Untar the file to the /opt directory; for example:
    [root@t19c6264 opt]# tar xvfz /home/userx/apache-tomcat-6.0.37.tar.gz
  4. Open the %TomcatDir%/conf/server.xml file (for example, /opt/tomcat6/conf/server.xml).
  5. Set the port attribute to a port that is not currently used.
    For example:
    <Connector port="8090" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    Note: By default, port 8080 is used, but this may conflict with the GlassFish server port.
  6. Save and close the %TomcatDir%/conf/server.xml file.
  7. Create the setenv.sh file in %TomcatDir%/bin/ and add the following lines:
    #!/bin/sh
    JRE_HOME="<JRE_Location>"
    export JAVA_OPTS
    export JRE_HOME
  8. To make the file executable, enter:
    chmod a+x <filename>
    For example:
    chmod a+x /opt/tomcat6/bin/setenv.sh
  9. Replace <JRE_Location> with the path to the Java installation on your machine:
    For example:
    JRE_HOME="/usr/java/jre1.7.0_51"
  10. Save and close setenv.sh.
    Note: Make sure that setenv.sh has the same owner and permissions as startup.sh.
  11. Start Tomcat from the %TomcatDir%/bin/ directory, as follows:
    [root@t19c6264 bin]# ./startup.sh
    An output similar to the following is displayed:
    Using CATALINA_BASE:   /opt/tomcat6
    Using CATALINA_HOME:   /opt/tomcat6
    Using CATALINA_TMPDIR: /opt/tomcat6/temp
    Using JRE_HOME:        /usr/java/jre1.7.0_51
    Using CLASSPATH:       /opt/tomcat6/bin/bootstrap.jar