Archive for February, 2014

Java installation: 
( https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Installation_Guide/Install_OpenJDK_on_Red_Hat_Enterprise_Linux.html )

openjdk:
yum install java-1.7.0-openjdk-devel

When the installation is finished openjdk will be found at
/usr/lib/jvm
So the jdk path all the way is
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64

This can be set as java home path

To set the java home:

vi /etc/profile.d/java.sh
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

Save and quit the file.

Now,
# su root
# export $PATH
# echo $JAVA_HOME ——–Will show the java home path if it is set properly.

jdk installation:

Download from the below link
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html (Grab a tar from it)

# mkdir /usr/java/
Move the downloaded jdk software to this path and extract it.

Now set the java home as below:

vi /etc/profile.d/java.sh
JAVA_HOME=/usr/java/jdk1.7.0_51
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

Save and quit the file.

Now,
# su root
# export $PATH
# echo $JAVA_HOME ——–Will show the java home path if it is set properly.

Tomcat installation:

Pre-requisites:
1. Java, jdk or java-openkdk

2. Set the java home properly

Installation:

Download
http://apache.mirrors.hoobly.com/tomcat/tomcat-7/v7.0.52/bin/apache-tomcat-7.0.52.tar.gz

# mv apache-tomcat-7.0.52.tar.gz /usr/share/
# cd /usr/share/

Extract it

# tar -xvzf apache-tomcat-7.0.52.tar.gz
# cd /usr/share/apache-tomcat-7.0.52/bin

Add below line in /usr/share/apache-tomcat-7.0.52/bin/catalina.sh file for tomact at 2nd line of the file in order to start or stop apache-tomcat services properly

JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64 ——- For openjdk installation
or
JAVA_HOME=/usr/java/jdk1.7.0_51 —– For jdk installation

Start or stop services:

Start: ./startup.sh
Stop: ./shutdown.sh

# netstat -tunlp | grep java

Runs on 8080, 8005 and 8009 by default

We Can make changes to /usr/share/apache-tomcat-7.0.52/conf/server.xml to change the port numbers.

Check the tomcat default homepage with

http://localhost:8080

Startup script for apache-tomcat services which useful for on bootup

# vi /etc/init.d/tomcat

Add below lines:

#!/bin/bash

# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
#JAVA_HOME=/usr/java/jdk1.7.0_51
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat-7.0.52

case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0

Save and quit the file

change permitions if needed:

# chmod 755 /etv/init.d/tomcat

# /etc/init.d/tomcat start/stop

###################################################