LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-30-2010, 01:16 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 676
Blog Entries: 2

Rep: Reputation: 36
Help needed to install Apache Tomcat


I want to setup apache tomcat on my linux distribution .

I Have downloaded apache tomcat from below mentioned link.

Administration Web Application:
http://tomcat.apache.org/download-55.cgi

The setup was in following format.
apache-tomcat-5.5.29-admin.tar.gz

Below are the command i have used to install the software.
I have copied the file to / directory
Quote:
gunzip apache-tomcat-5.5.29-admin.tar.gz
tar -xvf apache-tomcat-5.5.29-admin.tar
Now there is a folder called apache-tomcat-5.5.29 in my root directory.

I m currently stuck at this step .What should be my next step. i had no trouble installing it on my windows box but since i m new to linux request you to help me install it.

My linux distribution detail:
Quote:
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: EnterpriseEnterpriseServer
Description: Enterprise Linux Enterprise Linux Server release 5.2 (Carthage)
Release: 5.2
Codename: Carthage
Java Version:
Quote:
# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20071124 (Red Hat 4.1.2-42)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Last edited by pinga123; 04-30-2010 at 01:18 AM.
 
Old 04-30-2010, 01:25 AM   #2
pinga123
Member
 
Registered: Sep 2009
Posts: 676
Blog Entries: 2

Original Poster
Rep: Reputation: 36
After few searching here and there i came to know that i needed to install tomcat core setup first .

I have now installed core tomcat.

Now whenever i run startup.sh .It says
Quote:
"Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
"
What should be the next step?
How can i determine whether the java installed on my os or not.
Output of java -version
Quote:
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20071124 (Red Hat 4.1.2-42)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Last edited by pinga123; 04-30-2010 at 04:53 AM.
 
Old 04-30-2010, 06:00 AM   #3
pinga123
Member
 
Registered: Sep 2009
Posts: 676
Blog Entries: 2

Original Poster
Rep: Reputation: 36
I have somehow managed to run startup.sh


Quote:
[root@TESTOVM bin]# ./startup.sh
Using CATALINA_BASE: /apache-tomcat-5.5.29
Using CATALINA_HOME: /apache-tomcat-5.5.29
Using CATALINA_TMPDIR: /apache-tomcat-5.5.29/temp
Using JRE_HOME: /usr/java/jre1.6.0_20
Using CLASSPATH: /apache-tomcat-5.5.29/bin/bootstrap.jar
Now how do i access the home page of tomcat?
 
Old 05-17-2010, 06:20 AM   #4
spidy402
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Rep: Reputation: 0
I faced the same problem. Same as Pinga123....
But no one their to replay or direct any solution...
Where is moderation... ?
This site is still working. ?
Hey Pinga123 !!! Let me find solution on other site...and if it work for me i post here...
Linux is hard but not impossible.
 
Old 05-17-2010, 06:57 AM   #5
ajeetsinghraina
Member
 
Registered: May 2010
Location: India
Distribution: Ubuntu 7.04/8.04/8.10/10.04, RHEL 6, OpenSUSE,Mandriva,Fedora, CentOS, XandrOS, Slackware, OpenSolar
Posts: 155

Rep: Reputation: 55
Guys,
Hang on !!

Code:
Where is moderation... ?
You can't force anyone to answer you in so short time. this is an open collaborative project and not the paid service.
For experts from any particular field answer your query , you need to wait.
 
Old 05-17-2010, 07:13 AM   #6
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
@post #4

Quote:
Where is moderation... ?
This site is still working. ?
My friend, we are not paid to help you with your university work or your job itself. We are a community who dedicate ourselves to helping people learn Linux and thus grow the community.

Thus no amount of moderation forces ANY member of this site to respond to your little outbursts. And yes this site is still working 100%...if you look at the way pinga_123 tried to figure stuff out himself; this is what is promoted on LQ - try to figure stuff out yourself with members helping you out along the way.

@pinga_123

The home page for Tomcat can be accessed at http://localhost:8080/ if you did the default install.

Just out of curiousity, is there a reason that you're using such an old version of Tomcat (the latest is Tomcat 6)?

Cheers
Yas

Last edited by alli_yas; 05-17-2010 at 07:14 AM.
 
Old 05-17-2010, 11:33 PM   #7
pinga123
Member
 
Registered: Sep 2009
Posts: 676
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by alli_yas View Post
@post #4



My friend, we are not paid to help you with your university work or your job itself. We are a community who dedicate ourselves to helping people learn Linux and thus grow the community.

Thus no amount of moderation forces ANY member of this site to respond to your little outbursts. And yes this site is still working 100%...if you look at the way pinga_123 tried to figure stuff out himself; this is what is promoted on LQ - try to figure stuff out yourself with members helping you out along the way.

@pinga_123

The home page for Tomcat can be accessed at http://localhost:8080/ if you did the default install.

Just out of curiousity, is there a reason that you're using such an old version of Tomcat (the latest is Tomcat 6)?

Cheers
Yas
Thanks for your help .
I m going to Post my experience in installing TOMCAT on linux.

Your comments are highly appreciated.

OS : Oracle Enterprise Linux 5.2 32bit
Step1: Install Tomcat, JDK, JRE

We are going to install following softwares in the newly created machines.

Make a folder named install in /.
Copy all the required softwares in /install.

Quote:
apache-tomcat-5.5.29.tar.gz
jdk-6u20-linux-i586-rpm.bin
jre-6u20-linux-i586-rpm.bin
Installation Guide:

1)apache-tomcat-5.5.29.tar.gz:

I have choosen linux version of tomcat.
For Initial Setup You should always go for
Core version download.
downloaded apache-tomcat-5.5.29.tar.gz
Code:
#gunzip apache-tomcat-5.5.29.tar.gz
#tar -xvf apache-tomcat-5.5.29.tar.gz
This will create a new folder as apache-tomcat-5.5.29 in same directory.
go to apache-tomcat-5.5.29/bin
run
Code:
#./startup.sh
it will not run as java new version is not yet installed.

2) jdk-6u20-linux-i586-rpm.bin:
Next we will install latest jdk version.
Code:
chmod +x jdk-6u20-linux-i586-rpm.bin
#./ jdk-6u20-linux-i586-rpm.bin
This will create a new folder in
Code:
/usr/java/jdk1.6.0_20/
use it for JAVA_HOME.



3) jre-6u20-linux-i586-rpm.bin
Next we will install latest jre version.
Code:
chmod +x jre-6u20-linux-i586-rpm.bin
#./jre-6u20-linux-i586-rpm.bin
This will create a new folder in
/usr/java/jre1.6.0_20/
use it for JRE_HOME.

Step2:Configure java and TOMCAT

# javac -version
javac 1.6.0_20
# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20071124 (Red Hat 4.1.2-42)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


######At this time java is set to default java in linux our aim is to change it to latest java version.
for setting up this you need root login therefore type

Code:
#su
######Then you type

Code:
#/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_20/bin/java 2
######Finally you type
Code:
#;/usr/sbin/alternatives --config java
........ and choose '2'nd option.


Now make sure you disable firewall .
Code:
# system-config-securitylevel
Disable the firewall

I have created a script called Tomcat and pasted following content inside it.(All credit goes to original script writer)
Code:
#	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=/install/apache-tomcat-5.5.29
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
export JAVA_HOME=/usr/java/jdk1.6.0_20


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

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

restart(){
    stop
    start
}


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

exit 0

Edit the lines that start with tomcat and export to match

Save the script with name “tomcat” to a location “/etc/init.d”

(at least on most newer releases since /etc/init.d is a standard now). Then you have to allow execute access to the script, so run:

Code:
chmod a+x tomcat
Add to appropriate run level directories

The easy way to do this is to just simply run:

Code:
chkconfig --add tomcat

Add username/Password for tomcat manager:
How to add a new user name to tomcat manager:

just add line number 3 and 6 to /install/apache-tomcat-5.5.29/conf/tomcat-users.xml
Quote:
1) <?xml version='1.0' encoding='utf-8'?>
2) <tomcat-users>
3) <role rolename="manager"/>
4) <role rolename="tomcat"/>
5) <role rolename="role1"/>
6) <user username="manager" password="tomcat" roles="manager,tomcat"/>
7) <user username="tomcat" password="tomcat" roles="tomcat"/>
8) <user username="both" password="tomcat" roles="tomcat,role1"/>
9) <user username="role1" password="tomcat" roles="role1"/>
10) </tomcat-users>
Restart tomcat server.
By using service tomcat restart.

If anybody faces any issue just PM me .I will try to help as soon as possible.

Some additional Information::

To check whether the Tomcat is running or not.(Contributed by Alli yas).

Code:
#netstat -ntpl | grep java
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      6375/java
tcp        0      0 :::8009                     :::*                        LISTEN      6375/java
tcp        0      0 :::8080                     :::*                        LISTEN      6375/java
You should see at least one java process and you can use ps to identify if this is Tomcat.
Code:
# ps -ef | grep 6375
root      6375     1  0 May18 pts/2    00:01:06 /usr/java/jdk1.6.0_20/bin/java -Djava.util.logging.config.file=/install/apache-tomcat-5.5.29/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/install/apache-tomcat-5.5.29/common/endorsed -classpath /install/apache-tomcat-5.5.29/bin/bootstrap.jar -Dcatalina.base=/install/apache-tomcat-5.5.29 -Dcatalina.home=/install/apache-tomcat-5.5.29 -Djava.io.tmpdir=/install/apache-tomcat-5.5.29/temp org.apache.catalina.startup.Bootstrap start
root      9222  5091  0 18:29 pts/2    00:00:00 grep 6375

Last edited by pinga123; 05-19-2010 at 02:36 AM.
 
Old 05-18-2010, 12:21 AM   #8
ajeetsinghraina
Member
 
Registered: May 2010
Location: India
Distribution: Ubuntu 7.04/8.04/8.10/10.04, RHEL 6, OpenSUSE,Mandriva,Fedora, CentOS, XandrOS, Slackware, OpenSolar
Posts: 155

Rep: Reputation: 55
You can rather put it under one of your blog and refer the post whenever anyone faces issue setting up Apache and Tomcat.
Good work !!
 
Old 05-18-2010, 02:54 AM   #9
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Excellent stuff pinga_123

To add on to what you've done. If ever you want to debug whether Tomcat has started do the following:

Code:
#netstat -ntpl
You should see at least one java process and you can use ps to identify if this is Tomcat.

Also, monitor $CATALINA_HOME/logs/catalina.out - this is a VERY useful file that will show any exceptions that are thrown if the app server fails to start.

Feel free to PM me as well for Tomcat related issues
 
1 members found this post helpful.
Old 05-18-2010, 03:12 AM   #10
captain_sensible
Member
 
Registered: Apr 2010
Posts: 72

Rep: Reputation: 0
hi

just wanted to add that also had problems with Tomcat & as a newbie didn't want to do to much configuation.
The bigest problem was path, java_home etc; i think i'm right in saying that if you use apt-get your system configures these setting s for you

At the end of this post is a link to how I did it. Also if your goingto get Tomcat I don't see the point in needig Apache since Tomcat serves html files just as easily as jsp files.

http://www.linuxquestions.org/questi...needed-802179/
 
Old 05-18-2010, 03:48 AM   #11
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Quote:
just wanted to add that also had problems with Tomcat & as a newbie didn't want to do to much configuation.
The bigest problem was path, java_home etc; i think i'm right in saying that if you use apt-get your system configures these setting s for you
Yes you are right - when you install via a deb package (Ubuntu/Debian/etc) or rpm (Redhat/Fedora/CentOS) - the person who built the package has already defined the way in which the package will be extracted and installed.

Thus you need to either read the documentation for the rpm you have downloaded or query the rpm itself to try to determine where the different files will be placed.

Another way of doing things (I'm not saying its right - its what I do to make my life easier ) is to download and install applications manually via either tarballs (Tomcat), binary installs (java), source etcetera - its longer and a bit more difficult; but you can control where things are installed - and you won't have trouble with JAVA_HOME locations and so forth.

Quote:
Also if your goingto get Tomcat I don't see the point in needig Apache since Tomcat serves html files just as easily as jsp files
There definitely is a point to Apache (or any other dedicated web server). Sure Tomcat can serve up html; but it is not an advanced web server like Apache is - things like reverse proxies, virtual hosting, load balancing modules etcetera are not supported on Tomcat.

Further, remember that Tomcat is tightly coupled to the JVM, so if your Java fails for some reason; then your web server also fails - versus Apache which will continue running - this thus is also a consideration.
 
1 members found this post helpful.
Old 05-19-2010, 02:31 AM   #12
pinga123
Member
 
Registered: Sep 2009
Posts: 676
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by alli_yas View Post
Excellent stuff pinga_123

To add on to what you've done. If ever you want to debug whether Tomcat has started do the following:

Code:
#netstat -ntpl
You should see at least one java process and you can use ps to identify if this is Tomcat.

Also, monitor $CATALINA_HOME/logs/catalina.out - this is a VERY useful file that will show any exceptions that are thrown if the app server fails to start.

Feel free to PM me as well for Tomcat related issues
Thank you very much.
I tried as you said its work great . I m posting the result of my output.

Code:
 #netstat -ntpl | grep java
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      6375/java
tcp        0      0 :::8009                     :::*                        LISTEN      6375/java
tcp        0      0 :::8080                     :::*                        LISTEN      6375/java
# ps -ef | grep 6375
root      6375     1  0 May18 pts/2    00:01:06 /usr/java/jdk1.6.0_20/bin/java -Djava.util.logging.config.file=/install/apache-tomcat-5.5.29/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/install/apache-tomcat-5.5.29/common/endorsed -classpath /install/apache-tomcat-5.5.29/bin/bootstrap.jar -Dcatalina.base=/install/apache-tomcat-5.5.29 -Dcatalina.home=/install/apache-tomcat-5.5.29 -Djava.io.tmpdir=/install/apache-tomcat-5.5.29/temp org.apache.catalina.startup.Bootstrap start
root      9222  5091  0 18:29 pts/2    00:00:00 grep 6375
 
Old 05-19-2010, 02:02 PM   #13
captain_sensible
Member
 
Registered: Apr 2010
Posts: 72

Rep: Reputation: 0
alli yas

thanks for info

so your are talking about ... tar xfv tarball

./configure
make
make install

i have done that a couple of times with other more simple programmes but not tomcat.
ok so you download tomcat source from jakarta or equivalnet source. i'm interested in an outline of the install sequence
my path to ROOT (tomcat web root) is /var/lib/tomcat6/webapps/ROOT although once it ended up user/share/
so would you mkdir tomcat6 in /var/lib/ then untar inside tomcat6 or would that end up tomcat6/tomcat6
something along those lines....
 
Old 05-19-2010, 02:14 PM   #14
brucehinrichs
Member
 
Registered: Mar 2008
Location: US
Distribution: Debian Sid; Sabayon, UbuntuStudio, Slackware-multilib 13.1, Peppermint Ice, CentOS
Posts: 575

Rep: Reputation: 67
Quote:
so your are talking about ... tar xfv tarball

./configure
make
make install
This is generally how to compile packages in linux. Some packages do it a little differently for different reasons. The best bet is to read any documentation (README, INSTALL, something similar) for specific instructions.
 
Old 11-08-2010, 05:43 PM   #15
spuds99
LQ Newbie
 
Registered: Nov 2010
Posts: 2

Rep: Reputation: 0
Tomcat script throwing errors

All,

I am trying to set up Tomcat v6 to run on a red hat server. I copied the "tomcat" script above in this thread, edited it, and am trying to run from the command as a first step.

I get the following feedback:

serverY#./tomcat start
: command not found
: No such file or directory.d/functions
: command not found
: command not found
: command not found
'/tomcat: line 23: syntax error near unexpected tokem '{
'/tomcat: line 22: 'start(){

Here are my changes to the tomcat script:

# source function library
. /etc/init.d/functions

# get config
. /etc/sysconfig/network-scripts

...

tomcat=/usr/ .../apache-tomcat-6...
...
export JAVA_HOME=/usr/java/jdk1.6.0_21

Can you give me some ideas on how to debug this script?

Thank you.

- Spuds
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
install apache tomcat sandeepthug Linux - Server 4 03-19-2010 12:25 PM
How to install apache-tomcat-5.5.27-admin.tar.gz srinivasmiriyalu Solaris / OpenSolaris 10 08-13-2009 03:17 AM
Apache Tomcat 5.5 install issues. brave heart Red Hat 4 08-05-2007 09:46 PM
Is Apache 2.2.0 mod_proxy_ajp needed for tomcat? cygnus-x1 Linux - Software 2 10-16-2006 07:50 PM
Install tomcat as a module of Apache for running JSP kernelvn Linux - Networking 1 09-27-2004 11:41 PM


All times are GMT -5. The time now is 04:52 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration