Tomcat
Ninereasons (Talk | contribs) m (→Setup Environment Variables) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
==Installation== | ==Installation== | ||
− | ===Versions | + | ===Versions=== |
The packages and version numbers I will be installing/working with here are: | The packages and version numbers I will be installing/working with here are: | ||
<li>[http://www.freebsdwiki.net/index.php/Installing_FreeBSD_-_Standard_Installation FreeBSD 6.1] | <li>[http://www.freebsdwiki.net/index.php/Installing_FreeBSD_-_Standard_Installation FreeBSD 6.1] | ||
Line 13: | Line 13: | ||
<li>[http://www.freebsdwiki.net/index.php/PostgreSQL PostgreSQL 8.1.4] | <li>[http://www.freebsdwiki.net/index.php/PostgreSQL PostgreSQL 8.1.4] | ||
<li>KATE 2.5.3 | <li>KATE 2.5.3 | ||
− | |||
===Install Java=== | ===Install Java=== | ||
Line 37: | Line 36: | ||
− | ===Setup Environment Variables | + | ===Setup Environment Variables=== |
Editing /etc/profile | Editing /etc/profile | ||
JAVA_HOME=/usr/local/diablo-jdk1.5.0; export JAVA_HOME | JAVA_HOME=/usr/local/diablo-jdk1.5.0; export JAVA_HOME | ||
− | + | CATALINA_HOME="/usr/local/tomcat5.5"; export CATALINA_HOME | |
− | + | CATALINA_BASE="/usr/local/tomcat5.5"; export CATALINA_BASE | |
− | + | CATALINA_TMPDIR="/usr/local/tomcat5.5/temp"; export CATALINA_TMPDIR | |
CLASSPATH="/sbin:/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/tomcat5.5/common/lib/servlet-api.jar: | CLASSPATH="/sbin:/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/tomcat5.5/common/lib/servlet-api.jar: |
Latest revision as of 15:44, 21 October 2006
Tomcat is used as a server to run Java Servlets. It can be used stand alone or through Apache. Java Servlets is a great language which is very flexible. You can perform balance loading and connect to many great database engines such as postgres. There are many frameworks which you can use to speed up development and keep your code organised, a popular framework is 'struts'.
In this document I will explain how to setup jakarta-tomcat-5.5
Contents |
[edit] Installation
[edit] Versions
The packages and version numbers I will be installing/working with here are:
[edit] Install Java
cd /usr/ports/java/diablo-jdk15/ && make install clean Java will require you to download a heap of files separately through the browser and place them in /usr/ports/distfiles
[edit] Install Tomcat
Install tomcat from ports as the post-install scripts help configure the system faster.
- cd /usr/ports/*/tomcat55
- make install
[edit] Install ANT
Used for compiling
- pkg_add -r apache-ant
[edit] Configure
There is a lot of configuration and tests which you can do in tomcat. Here I'm going to show a basic setup in which you should be able to start some projects.
[edit] Startup
If you want all the servers to load up on boot here is what you have to add to /etc/rc.conf
tomcat55_enable="YES" postgresql_enable="YES"
[edit] Setup Environment Variables
Editing /etc/profile
JAVA_HOME=/usr/local/diablo-jdk1.5.0; export JAVA_HOME CATALINA_HOME="/usr/local/tomcat5.5"; export CATALINA_HOME CATALINA_BASE="/usr/local/tomcat5.5"; export CATALINA_BASE CATALINA_TMPDIR="/usr/local/tomcat5.5/temp"; export CATALINA_TMPDIR CLASSPATH="/sbin:/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/tomcat5.5/common/lib/servlet-api.jar: /usr/local/tomcat5.5/common/lib/jsp-api.jar:.";export CLASSPATH
[edit] Tomcat Servlet Reloading
So that your modifications are automatically reloaded on your development box edit: /usr/local/tomcat5.5/conf/context.xml and change:
<Context>
to
<Context reloadable="true">
[edit] First time startup
To start the tomcat server for the first time here is what you do:
shell# cd /usr/local/tomcat5.5/bin shell# bash shell# JAVA_HOME=”/usr/local/diablo-jdk1.5.0”;export JAVA_HOME shell# ./startup.sh
[edit] Using Tomcat
The default for tomcat is http://<ip>:8180 (used to be on port 8080)
The work area is /usr/local/tomcat5.5/webapps
You can enter project_name.war files into the webapps directory then access them like so:
http://<ip>:8180/project_name