Go Back   Digit's Technology Discussion Forum > Across The Board > QnA

QnA This is the place to share what you know, and learn what you don’t. If you have questions that do not qualify as either Hardware or Software questions, post them here...

Reply
 
Thread Tools Search this Thread Display Modes
Old 14-07-2006, 07:58 AM   #1
mohnishghodekar
Right Off the Assembly Line
 
Join Date: Sep 2005
Posts: 25
Exclamation Installing Apache Tomcat

Can anyone tell me how to install apache tomcat 5.5 server? please do not mention the apache tomcat homepage as your reply
__________________
I always Think in terms of technology & thats how i have become a champ.
mohnishghodekar is offline   Reply With Quote

Old 14-07-2006, 09:00 AM   #2
onlineteachers.co.nr
Right Off the Assembly Line
 
Join Date: Jul 2006
Posts: 2
Default Re: Installing Apache Tomcat

dear you have noy mentioned the operating system.
is it linux or windows??

for linux

I am explaining it for redhat linux.

make sure you have 1.5 version of sun's JDK.check /usr/java/<jdk_version>/


get the core package of tomcat from apache wensite.
make directory /user/local/tomcat
this makes upgrade easier later.

[guru@onlineteachers ~]$ tar -xzf apache-tomcat-5.5.17.tar.gz
[guru@onlineteachers ~]$ sudo mv apache-tomcat-5.5.17 /usr/local/
[guru@onlineteachers ~]$ cd /usr/local/
[guru@onlineteachers local]$ sudo ln -s apache-tomcat-5.5.17/ tomcat

sudu is used where commands need to be run as root.

now set environment variables

JAVA_HOME - needs to point to your Java install. (If you used the latest Sun RPM that will be /usr/java/jdk1.5.0_6)
CATALINA_HOME - should be set to /usr/local/tomcat

start Tomcat with the command /usr/local/tomcat/bin/startup.sh and stop Tomcat with the command /usr/local/tomcat/bin/shutdown.sh

Setting Tomcat up as a Service

To do this you need to copy the code below and save it as a file called tomcat in the folder /etc/init.d:
# This is the init script for starting up the
# Jakarta Tomcat server
#
# chkconfig: 345 91 10
# description: Starts and stops the Tomcat daemon.
#

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

tomcat=/usr/local/tomcat
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
export JAVA_HOME=/usr/java/jdk1.5.0_06
export CATALINA_HOME=/usr/local/tomcat

start(){
echo -n $"Starting Tomcat service: "
$startup
RETVAL=$?
echo
}

stop(){
action $"Stopping Tomcat service: " $shutdown
RETVAL=$?
echo
}

status(){
numproc=`ps -ef | grep catalina | grep -v "grep catalina" | wc -l`
if [ $numproc -gt 0 ]; then
echo "Tomcat is running..."
else
echo "Tomcat is stopped..."
fi
}

restart(){
stop
sleep 5
start
}


# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac

exit 0

You may have to change the value for JAVA_HOME if your JDK is in a different location to mine. You then need to make the file executable with the command:
sudo chmod +x /etc/init.d/tomcat

And finally you need to set it to start at boot with the command:
sudo chkconfig --add tomcat

You now have a working Tomcat install that will start it self at boot time. You can also interact with it using the service command to start, stop, restart and see the status of the service at any time. E.g.
sudo service tomcat start
sudo service tomcat satus
sudo service tomcat stop
__________________
http://onlineteachers.co.nr/
A Teacher's Online Guide
online guide for study notes online tests quiz articles study plans to help students get better grades in exams

Last edited by onlineteachers.co.nr; 14-07-2006 at 09:12 AM.
onlineteachers.co.nr is offline   Reply With Quote
Reply

Bookmarks


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Upcoming Events





Think diget  
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.