Bobcares

How to Setup Additional Tomcat Instances on your Linux Server

by | Aug 24, 2009

Tomcat is a stand-alone application web server which serves web pages containing Java Server Page(JSP) coding. It provides an environment to execute dynamic applications, like JSP and Java servlets.

It communicates with Apache via mod_jk and support servlets and JSPs. Tomcat can be used as an independent web server, with its own internal HTTP server, or can be used in combination with other web servers, like Apache webserver.

See how we maintain your servers!

JDK(Java Development Kit)

For proper execution, Tomcat requires JDK(Java Development Kit). JDK that contains API classes, Java compiler(javac), Java Virtual Machine(JVM) provides the basic tools to compile Java applications and applets.

Install JDK

You can download the latest version of JDK(JDK 7) from Sun’s Java web URL’s at:

http://java.sun.com/products/archive/index.html
http://java.sun.com/products/archive/j2se/1.4.2_08/index.html
http://java.sun.com/j2se/1.4.2/download.html

Unpack and install JDK in the directory /usr/local/. Now, we need to define the environment variable JAVA_HOME, such that it points to the java installation directory “/usr/local/jdk1.5.0“.

Add the following lines to the “/etc/bashrc” or “/etc/profile” file, so that the environment variable can be used by all aplications/users in the server.

JAVA_HOME=/usr/local/jdk1.5.0
export JAVA_HOME

[ You don’t have to be an expert to keep your servers fast and stable. Click here to keep your servers lightning fast with our 24/7 Server Administration services]

Install Tomcat

The Tomcat complete package is available for download at the following URL :
http://tomcat.apache.org/download-55.cgi

Download the latest version of Tomcat and Install it in the /usr/local directory.

mv apache-tomcat-5.5.26.tar.gz /usr/local
tar -xvzf apache-tomcat-5.5.25.tar.gz

Now, create the following symbolic link.

ln -s /usr/local/apache-tomcat-5.5.25 /usr/local/tomcat

We can then run the Tomcat web server using a seperate user “tomcat”. Add the user and group “tomcat”.

groupadd tomcat
useradd -g tomcat -c "Tomcat User" -d /usr/local/tomcat tomcat
passwd tomcat <password for user>

Change the ownership of Tomcat installation directories.

chown tomcat:tomcat /usr/local/tomcat
chown -R tomcat:tomcat /usr/local/apache-tomcat-5.5.25

The installation of Tomcat is now complete. We can start the Tomcat instance using a startup script “/usr/local/tomcat/bin/startup.sh“. Also, make sure to define the variable CATALINA_HOME in the script “/usr/local/tomcat/bin/catalina.sh“.

CATALINA_HOME=/usr/local/tomcat

The default Tomcat configuration will service HTTP requests on port 8080. You can access this Tomcat instance using the URL http://server_IP:8080/, where server_IP is the address of the machine where we just now installed the Tomcat server.

In order to shut down the Tomcat service, use the script :

/usr/local/tomcat/bun/shutdown.sh

You can access the Tomcat Manager Interface corresponding to this Tomcat installation using the URL:

http://server_IP:8080/manager/

You can also configure the Manager Application Access using a username and password combination that has the role “manager” associated to them. All you have to do to enable this access is edit the Tomcat users configuration file.

/usr/local/tomcat/conf/tomcat-users.xml

By default, the Manager application is completely disabled. To enable access to the Manager web application, add the following entry in /usr/local/tomcat/conf/tomcat-users.xml.

<tomcat-users>
<role rolename="manager"/>
<user username="admin" password="tomcat" roles="manager"/>
</tomcat-users>

Once you restart the Tomcat service after this, you will be able to access the Manager interface using the login details admin/tomcat.

GET YOUR CUSTOM SERVER SETUP!

Get instant server setup with your preferred software, in no time.

CLICK NOW FOR CUSTOM SOFTWARE INSTALL

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

3 Comments

  1. heilkräuter

    The process includes :
    Step 1: Install the Tomcat files
    Step 2: Make directories for each instance
    Step 3: Configure the ports and/or addresses for each instance
    Step 4: Startup

    Reply
  2. ajai kumar

    Hi

    FYI! this is vinodh here! i have a doubt regarding “SYNFLOOD”

    Im running a webserver with apache,tomcat,the problem is tomcat is down,
    when i debugged,
    # messages.log i found this –
    (Kernel: possible SYN flooding on port 8009. Sending cookies)

    # mod.jk logs i found this –
    (Tomcat is down or refused connection. No response has been sent to the client (yet)

    # error.log i found this –
    server reached MaxClients setting, consider raising the MaxClients setting

    i know that the kernal have dropped the connections

    a) my doubt is this is a syn attack?
    b) does the syn attack is the reason for tomcat down?
    c) when there is a syn flood – i have an alert from my monitoring tool
    d)could plz clarify me

    does syn attack is responsible for tomcat down or does it is the increase in no of maximum clents as per error log is the cause of the tomcat down?

    i googled & searched all forums, but i’m yet to find a solution!

    please give me a solution?

    Reply
  3. Shailu

    after I did alll above configurations and run chown command I am getting follwing error

    /usr/local/tomcat2/bin$ ./startup.sh
    ./catalina.sh: 1: ./catalina.sh: /usr/local/tomcat2: Permission denied
    Cannot find /bin/setclasspath.sh
    This file is needed to run this program

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.