LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-11-2003, 04:10 PM   #1
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Rep: Reputation: 30
How to install / configure Tomcat as a webserver


Breif notes for those that need to install Tomcat as a stand alone webserver - hopefully it'll help someone avoid the pitfalls(!) This is specific to the configuration I've followed - though I have tried this with RH9 and SuSE8.1 and it works fine. Note - I did not have apache (or any other web server installed; this is purely a Tomcat web server install)

1. Aquire a copy of the java SDK from:
http://java.sun.com/j2se/1.4.1/download.html
I used the 1.4 SDK binary. Download j2sdk-1_4_1_03-linux-i586.bin from the site and save in your chosen install directory - I used /usr/local/.
2. chmod 755 j2sdk-1_4_1_03-linux-i586.bin and execute the file. There's a huge disclamer from sun - tab through, accept, and let the SDK install. It will install to /usr/local/j2sdk1.4.1_03.
3. Create an env variable JAVA_HOME=/usr/local/j2sdk1.4.1_03 (or whatever direcotry the SDK is installed to).
4. export JAVA_HOME
5. Download the tomcat binary from http://jakarta.apache.org/site/binindex.cgi
I chose Tomcat 4.1.24 which is the most recent at time of writing from ./bin/jakarta-tomcat-4.1.24-LE-jdk14.tar.gz - choose the LE version (light version) for java 1.4.X. Download, again, to /usr/local
6. gunzip jakarta-tomcat-4.1.24-LE-jdk14.tar.gz
7. tar -xvf jakarta-tomcat-4.1.24-LE-jdk14.tar
8. cd /usr/local/jakarta-tomcat-4.1.24-LE-jdk14/bin
9. ./startup.sh
10. From a web browser, http://localhost:8080 to view the default tomcat page.

To configure with apache, see a quick guide at http://www.johnturner.com/howto/rh72-howto.html

Last edited by davee; 07-12-2003 at 02:23 AM.
 
Old 07-11-2003, 10:21 PM   #2
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
Or this page... this is the instruction set I use to set up mod_jk2

http://jakarta.apache.org/tomcat/tom...jk2/index.html

check the config examples and Apache / IIS howto's. Very worthwhile reading to save yourself the headaches.

B.
 
Old 07-14-2003, 05:51 AM   #3
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Original Poster
Rep: Reputation: 30
Configuring Tomcat on port 80

If, as I am, you are running tomcat as your only webserver on a box, you can redirect all port 80 traffic to the tomcat port 8080 via iptables. Three additions to iptables:

iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A OUTPUT -d xxx.xxx.xxx.xxx -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -p tcp --dport 80 -j REDIRECT --to-ports 8080

...where xxx.xxx.xxx.xxx is the IP address of the box (Substitute DNS here if required).

Thanks to Holger Klawitter's site (http://www.klawitter.de/tomcat80.html) for this info.

Dave
 
Old 07-14-2003, 03:04 PM   #4
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
Or you can configure tomcat to listen on port 80...

${TOMCAT_HOME}/conf/server.xml (assuming 4.x)

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />

just change it to 80. Then you don't have to deal with iptables rules at all.

B.
 
Old 07-15-2003, 09:33 AM   #5
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Original Poster
Rep: Reputation: 30
Is there not a security issue with that, as tomcat runs as root?
 
Old 07-15-2003, 10:25 AM   #6
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
yes, I hadn't considered that... I guess user switching and chroot'ing would be kind of a PITA compared to just using iptables.

Apologies, that was bad advice.

B.
 
Old 07-16-2003, 03:32 AM   #7
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by german
I guess user switching and chroot'ing would be kind of a PITA compared to just using iptables.
I know - I use this method for development, where there's no security concerns... far simpler!

Dave
 
  


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
tomcat install help please. mpower Linux - Software 3 07-16-2004 08:53 PM
can not browse tomcat webserver on linux from windows Ibrahim Linux - Software 3 04-06-2004 11:38 AM
can not browse tomcat webserver on linux from windows Ibrahim Linux - Networking 0 03-24-2004 10:32 AM
TOMCAT init script not working on startup -- tomcat 4.x / Mandrake Linux 8.0 jmartinph Mandriva 0 03-08-2004 01:31 AM
Tomcat 4.1.24 install arkopolo Linux - Software 5 07-07-2003 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:34 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration