RSS

How to install Apache, Java, Tomcat and Solr

17 Sep

How to install Apache, Java, Tomcat and Solr

Here is the procedure to install Apache, Tomcat, Java and Solr:

First of all we need Apache in our box:
Download the Apache source.

tar -zxvf httpd-2.2.24.tar.gz
cd httpd-2.2.24
./configure --enable-so --enable-expires --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-headers --enable-ssl --enable-http --disable-userdir --enable-rewrite --enable-deflate --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-cgi --disable-dbd --enable-modules=most --with-mpm=worker --prefix=/usr/local/apache2
make; make install
/usr/local/apache2/bin/apachectl -t

./configure : Specify the modules which you want to install for your Apache ( ./configure with out specified modules will install all the modules )
–prefix= :  Its used to specify the path where you need to install Apache.
apachectl -t : To check the syntax of Apache

Download Java from oracle site as Tomcat and Solr will be needing Java to work, after that follow these steps:

chmod 777 jdk-6u17-linux-i586.bin
./jdk-6u17-linux-i586.bin
mkdir -p /usr/java
cp -r  jdk1.6.0_17 /usr/java/
ln -s /usr/java/jdk1.6.0_17/bin/java /usr/bin/java
java -version

Change the .bin permission to executable by +x or 755 or 777.
ln -s :  Created the soft link for java to be executed from any where, you can also create environment variable for java according to you need.
java -version will display the java version installed.

Now once your java is installed correctly and enviornment is set download the Tomcat:

tar -zxvf apache-tomcat-7.0.39.tar.gz
mkdir  -p  /usr/tomcat
cp -rf apache-tomcat-7.0.39/* /usr/tomcat/
ls /usr/tomcat/
/usr/tomcat/bin/version.sh

Now we need Tomcat Native to link Apache and Tomcat with each other so download the tomcat-connectors:

tar -zxvf tomcat-connectors-1.2.37-src.tar.gz
cd tomcat-connectors-1.2.37-src/native/
./configure --with-apxs=/usr/local/apache2/bin/apxs  --with-java-home=/usr/java/jdk1.6.0_17 --prefix=/usr
make
make install

Now add the configuration which you want to setup for your Tomcat server in httpd.conf and worker.properties:

cd /usr/local/apache2/conf/
cp httpd.conf httpd.conf.original
vi worker.properties
vi httpd.conf
../bin/apachectl stop
../bin/apachectl start

Here is demo configuration for httpd.conf and workers.properties:

configure httpd.conf. 

JkWorkersFile /usr/local/apache2/conf/worker.properties
JkLogFile logs/jk-log
# Set the jk log level debug/error/info
JkLogLevel info
# Select the log format
JkLogStampFormat "%a %b %d %H:%M:%S %Y "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Mount your applications
JkMount /rest/* node1 

 

configure workers.properties. 

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
# modifications after using mpm worker
worker.worker1.connection_pool_size=128
worker.worker1.connection_pool_timeout=600
worker.worker1.socket_keepalive=1  
 
Leave a comment

Posted by on September 17, 2013 in Apache Server

 

Leave a comment