Thursday, 11 July 2013

Easy way to Install and configure Apache tomcat Intigration with in Linux/RHEL/Centos

Apache HTTP Server : commonly none as a Apache, it's web server application. From long Apache is most popular web server in the internet. Normally Apache run on a Linux like Operating system, Apache developed and maintain by Apache software Foundation, it's open source application.
Apache handling only static pages.

Tomcat : Tomcat is a container, it's contain java servlet. Tomcat handling java servlet dynamic page requests. Tomcat latest version available here

We are here for discussing and integration of apache and tomcat on Linux platform. Now, I am using centos 6.2 server, Jre1.6, apache 2.2.x , tomcat7.0.29 for done this configuration.

1.First Install jre download from here :

# ls
# chmod +x jre-6u45-linux-x64-rpm.bin
# ./jre-6u45-linux-x64-rpm.bin
# java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
2. Install apache http server and components
#yum install httpd
#yum httpd-devel     ( it's provides /usr/sbin/apxs
#yum apr-devel       (provides the appropriate include files)
#apr                 (it's required by apr-devel)
#apr-util-devel (it's required by httpd-devel)
#apr-util           (it's required by apr-util)
# rpm -qa | grep httpd
you will see look like this, depends on Linux architecture.
Install compiler packages
#yum install gcc gcc-cpp gcc-c++
2. Download and Install apache tomcat package
#tar -zxvf apache-tomcat-7.0.29.tar.gz
3. Download tomcat-connectors
#tar -xvf tomcat-connectors-1.2.37-src.tar
# cd tomcat-connectors-1.2.32-src/native/
# which usr/sbin/apxs                                                                                                                                 
# ./configure --with-apxs=/usr/sbin/apxs --enable-api-compatibility
# make
# make install 
after completed this activity you will get file in /usr/lib64/httpd/modules/
if get it , going well
Installation part has been completed, let's start configuration part
4. Open httpd.conf file and add end of line.
# vi /etc/httpd/conf/httpd.conf
JkWorkersFile "/etc/httpd/conf/"
        JkLogFile "/var/log/httpd/mod_jk.log"
        JkRequestLogFormat "%w %V %T"
        JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
        JkLogLevel info
        JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkMount / worker1           (allow for all project)
JkMount /* worker1
allow specific project like as examples 
JkMount /examples worker1          
JkMount /examples* worker1

Note : use one given above both( allow for all project or allow specific project)
5. create file and make the entry
#vi  /etc/httpd/conf/
# Define Node1
save and exit
6. open the server.xml file make some changes
#vi /opt/apache-tomcat-7.0.29/conf/server.xml
 <!-- You should set jvmRoute to support load-balancing via AJP ie :-->
<Engine name="Catalina" defaultHost="localhost" jvmRoute=" jvmRoute">
 <Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
<Engine name="Catalina" defaultHost="localhost">
    <!--<Engine name="Catalina" defaultHost="localhost"> -->
save and exit.
Sart process : First start Tomcat then start Apache
#/etc/init.d/httpd start
Open the Browser and check the URL : http://localhost/examples
able to find this page

Apache Tomcat Examples

You have successfully done this job congratulation!

No comments:

Post a Comment

Install XRDP in Centos 7

rpm -Uvh yum update yum groupinstall "GNOME Desktop" ...