Thursday, September 30, 2010

How to integrate tomcat with apache on cpanel linux server?

Guys,

I didn't configure it but I am making it more available in the internet so that you can easily get the link and steps. Hope it'll help you to do the same. Here are the steps :

=======
1- Configure PATH
- vi or pico -w /etc/profile
- Add those lines after the first comments
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

JAVA_HOME=/usr/local/java/java
CATALINA_HOME=/usr/local/tomcat
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin:/sbin:/usr/sbin
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/common/lib/servlet.jar:/usr/local/pgsql/share/java/postgresql.jar:../lib/struts.jar:.

- Locate the line where you see export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC and add : JAVA_HOME CATALINA_HOME CLASSPATH


2- Download SDK at http://java.sun.com/j2se/1.4.2/download.html (j2sdk-1_4_2_03-linux-i586.bin)

3- Install java SDK
- mkdir /usr/local/java
- cd /usr/local/java
- chmod u+x j2sdk-version.bin
- ./j2sdk-version.bin
- ln -s j2sdk-version java
JAVA is installed under /usr/local/java/java/

4- Download Jakarta Tomcat at http://apache.mirror.mcgill.ca/jakarta/tomcat-4/v4.1.30/bin/jakarta-tomcat-4.1.30.tar.gz

5- Install Tomcat
- tar -zxvf jakarta-tomcat-4.1.30.tar.gz
- mv jakarta-tomcat-4.1.30 /usr/local/
- cd /usr/local
- ln -s jakarta-tomcat-4.1.30 tomcat
Tomcat is installed under /usr/local/tomcat/

6- Download Jakarta ANT at http://apache.mirror.cygnal.ca/ant/binaries/apache-ant-1.6.1-bin.tar.gz

7- Install Jakarta ANT
- tar -zxvf apache-ant-1.6.1-bin.tar.gz
- mv apache-ant-1.6.1 /usr/local/
- cd /usr/local
- ln -s apache-ant-1.6.1 ant
- ln -s /usr/local/ant/bin/ant /usr/local/bin/ant
- ln -s /usr/local/ant/bin/ant /usr/sbin/

8- Download the Java Connector from CVS and build / install mod_jk
- cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login password: anoncvs (When prompted for a password, just hit ENTER)
- cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout jakarta-tomcat-connectors
- mv jakarta-tomcat-connectors /usr/local/java/
- cd /usr/local/java/jakarta-tomcat-connectors/jk/native/
- ./buildconf.sh
- ./configure --with-apxs=/usr/sbin/apxs
- make
- cp apache-1.3/mod_jk.so /etc/httpd/modules/

9- Configure httpd.conf for mod_jk
- Doing a backup : cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
- Enabling mod_jk : vi or pico -w /etc/httpd/conf/httpd.conf
After this line :
LoadModule perl_module /usr/lib/apache/libperl.so

Add :
LoadModule jk_module /usr/lib/apache/mod_jk.so

After your last AddModule line, add :
AddModule mod_jk.c

Include "/usr/local/jakarta-tomcat-4.1.30/conf/mod_jk.conf"

10- Edit/Create /usr/local/jakarta-tomcat-4.1.30/conf/mod_jk.conf
- vi or pico -w /usr/local/jakarta-tomcat-4.1.30/conf/mod_jk.conf
- Enter those lines :


LoadModule jk_module /usr/lib/apache/mod_jk.so


JkWorkersFile "/usr/local/jakarta-tomcat-4.1.30/conf/jk/workers.properties"
JkLogFile "/usr/local/jakarta-tomcat-4.1.30/logs/mod_jk.log"


JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
JkMount /manager/* ajp13


JkLogLevel emerg

11- Edit/Create /usr/local/jakarta-tomcat-4.1.30/conf/jk/workers.properties
- mkdir /usr/local/jakarta-tomcat-4.1.30/conf/jk
- vi or pico -w /usr/local/jakarta-tomcat-4.1.30/conf/jk/workers.properties
- Enter those lines :

# Setting Tomcat & Java Home
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java/java
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

12- Edit /usr/local/jakarta-tomcat-4.1.30/conf/server.xml
cd /usr/local/jakarta-tomcat-4.1.30/conf/
rm -f server.xml
vi or pico -w server.xml
Copy - Past text below :










some-site.com








13- Edit /usr/local/jakarta-tomcat-4.1.30/conf/tomcat-users.xml







14- Download and install the tomcatd script
- Download the script at http://www.linuxjava.net/howto/webapp/install_files/tomcatd
- mv tomcatd /usr/sbin
- chmod 700 /usr/sbin/tomcatd
- vi or pico -w /usr/sbin/tomcatd
- Locate any lines that contain the text : su - tomcat -c $TOMCAT_START and replace it by : $TOMCAT_START

15- FINISH !! START TOMCAT AND TEST IT :)
- service httpd restart
- tomcatd start
=======

Ref : http://www.directadmin.com/forum/archive/index.php/t-2227.html

Try :)

No comments:

Post a Comment