Friday, January 7, 2011

Procedure to setup Apache Tomcat on Linux Server

Apache Tomcat Server setup
1.Files Required:
JDK (latest version) : http://java.sun.com [ TO INSTALL JAVA]
Apache Tomcat (latest version) : from http://tomcat.apache.org [ TO INSTALL TOMCAT ]
Apache HTTP server (latest version) : from http://httpd.apache.org [ TO INSTALL APACHE ]
Tomcat connector - mod_jk (latest version) : from http://tomcat.apache.org [ TO DOWNLOAD TOMCAT CONNECTOR ]
2.Preinstallation Requirements:
Before Installing the Apache HTTP server on Linux , the following package dependencies have to be installed in Linux box(while making RPM installation).
· Package: httpd-, gcc, sysstat
· Firewall configuration for port 80(default http),8080 and 22
· Hostname have to be registered in DNS
3. Information
The following order should be made for installation Apache/Tomcat on linux box
1.Java should be installed if we are configuring tomcat
2. Apache tomcat must be configured with the java and test the sample page
3.Apache HTTP server must be installed.
4.Tomcat connector must be installed
4. Installing JAVA:
Step 1: Download latest J2SE EE SDK from http://java.sun.com into the local linux box (The downloaded package will be like jdk--i586.rpm.bin)
Step 2:Execute installer (note : must be done as root)
# chmod +x jdk--i586.rpm.bin (setup execute permission to the downloaded bin file)
Step 3: Install java
# ./jdk--i586.rpm.bin
Do you agree with the above license terms? Yes
(then installation should proceed)
Step 4: Confirm packages are properly installed
# /usr/java/jdk/bin/java -version (To check the java version)
5. Installing Apache tomcat:
Step 1: Download selected version from http://tomcat.apache.org (File will be like apache-tomcat-.tar.gz)
Step 2: Untar the file
# tar xvzf apache-tomcat-.tar.gz
Step 3: Setup JAVA Home
# JAVA_HOME=/usr/java/default ./startup.sh (To Start Tomcat)
# JAVA_HOME=/usr/java/default ./shutdown.sh (To Stop Tomcat)
Step 4: To Enable headless mode:
File: /usr/local/tomcat/bin/catalina.sh (add near the top)
CATALINA_OPTS="-Djava.awt.headless=true"
Step 5 : Open testing page and check result
Open page http://IPADDRESS:8080 for test
6.Installing Apache Webserver:
Step 1: Download Apache http server from http://httpd.apache.org (File will be like httpd-.tar.gz)
Step 2: # tar zxvf httpd-.tar.gz
Step 3: # cd httpd-
Step 4: # ./configure --enable-MODULE=shared --enable-so --with-mpm=worker
Step 5: # make
Step 6: # make install
Step 7: Files to be configured for any changes are /etc/httpd/conf/httpd.conf
Step 8 : open testing page and check result
Open page http://IPADDRESS:80 for test
7. Installing tomcat connector:
Step 1: Download mod_jk from http://tomcat.apache.org (File will be like mod_jk-.so )
Step 2: # cp mod_jk-.so /apache2/modules
#[//apache2/modules/]# ln –s mod_jk-.so mod_jk.so
Step 3: Configuration:
create a new file with the name mod_jk.conf and workers.properties and add the below lines
# vi mod_jk.conf
#Specific workers.properties file
#LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
JkMount /servlet/* worker1
JkMount /*.jsp worker1
JkMount /*.do worker1
JkMount /sso/* worker1
# vi httpd.conf
Add below into httpd.conf
LoadModule jk_module modules/mod_jk.so
Include conf/mod_jk.conf
# vi workers.properties
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
Step 4: Restart Apache:
# /apache/bin
# ./apachectl start (To Start apache services)
# ./apachectl stop (To Stop apache services)

1 comment:

  1. Appreciate your formulating an exceptionally decent article, It happened to see your website page as well as several written piece. Is exceedingly good type publishing.web hostings

    ReplyDelete