Nethence Documentation Lab Webmail Your IP BBDock  


Those documents are obsolete, please use the Nethence Documentation instead.

HomeUnixWindowsOracleObsoleteHardwareDIYMechanicsScriptsConfigsPrivate

Tomcat configuration
 
 
Install with RHEL5 packages
Install apache, tomcat and deps,
yum install \
httpd \
tomcat5 \
tomcat5-webapps \
tomcat5-admin-webapps
 
Configure the environment,
grep _HOME /etc/sysconfig/tomcat5
grep _HOME /etc/ant.conf
cd ~/
vi .bashrc
add those lines,
JAVA_HOME="/usr/lib/jvm/java"
CATALINA_HOME="/usr/share/tomcat5"
TOMCAT_HOME="$CATALINA_HOME"
JASPER_HOME="/usr/share/tomcat5"
ANT_HOME=/usr/share/ant
export JAVA_HOME CATALINA_HOME TOMCAT_HOME JASPER_HOME ANT_HOME
apply,
source .bashrc
 
Start and enable the daemon,
service tomcat5 start
chkconfig tomcat5 on
 
Refs.
http://wiki.centos.org/HowTos/JavaOnCentOS
http://www.tummy.com/Community/Articles/tomcat-centos/tomcat5.html
 
 
Install from scratch
Install latest JDK (http://java.sun.com/javase/downloads/widget/jdk6.jsp) as root,
chmod +x jdk-6u18-linux-i586-rpm.bin
./jdk-6u18-linux-i586-rpm.bin
Note. for older JDKs try http://java.sun.com/javase/downloads/previous.jsp
 
Install latest Tomcat (http://tomcat.apache.org/download-60.cgi ==> fetch Core as tar.gz),
tar xvzf apache-tomcat-6.0.24.tar.gz
mv apache-tomcat-6.0.24 /usr/local/tomcat6024
cd /usr/local
ln -s tomcat6024 tomcat6
ln -s tomcat6 tomcat
 
Configure the environment,
cd ~/
vi .bashrc
add those lines,
JAVA_HOME=/usr/java/default
CATALINA_BASE=/usr/local/tomcat6
CATALINA_HOME=/usr/local/tomcat6
export JAVA_HOME CATALINA_BASE CATALINA_HOME
apply,
source .bashrc
 
Start Tomcat manually,
/usr/local/tomcat6/bin/startup.sh
and to shut it down,
/usr/local/tomcat6/bin/shutdown.sh
Note. you can also run it interactively (^C to shut it down),
/usr/local/tomcat6/bin/catalina.sh run
Note. no need to define CLASSPATH in your environment, tomcat scripts take precedence
 
Refs.
http://inputoutputnet.blogspot.com/2007/12/jdk-java-installation-on-centos-plus.html
 
 
Checks
Check everything works,
java -version
javac -version
ant -version
#ant -diagnostics
 
 
Tomcat configuration
Wipe out the XML comments,
cd /usr/local/tomcat/conf
mv context.xml context.xml.dist
mv server.xml server.xml.dist
mv tomcat-users.xml tomcat-users.xml.dist
mv web.xml web.xml.dist
gawk -v RS='<!--|-->' 'NR%2' context.xml.dist | sed '/^[[:space:]]*$/d;' > context.xml
gawk -v RS='<!--|-->' 'NR%2' server.xml.dist | sed '/^[[:space:]]*$/d;' > server.xml
gawk -v RS='<!--|-->' 'NR%2' tomcat-users.xml.dist | sed '/^[[:space:]]*$/d;' > tomcat-users.xml
gawk -v RS='<!--|-->' 'NR%2' web.xml.dist | sed '/^[[:space:]]*$/d;' > web.xml
Note. if using RHEL packages, '$CATALINA_HOME/conf' links to 'cd /etc/tomcat5'
 
Create/edit roles and users,
cd /usr/local/tomcat/conf
vi tomcat-users.xml
add those lines,
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="PASSWORD" roles="manager,admin"/>
note. change PASSWORD accordingly
apply,
/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
#service tomcat5 restart
 
Point your browser to server's URL and check it's responding,
http: //10.1.1.2/
then point it to the administration interface and login,
http: //10.1.1.2/admin/
admin/PASSWORD
then point it to the manager interface and login,
http: //10.1.1.2/manager/html
admin/PASSWORD
 
Refs.
http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2008-06/msg00376.html
http://webmail.appert44.org/~plegal/index.php/Tomcat
 
 
Troubbleshooting
Watch the logs,
#cd /usr/share/tomcat5/logs
cd /usr/local/tomcat/logs
tail -F *
#tail -F catalina.out
 
Apache / Tomcat configuration
Configure,
cd /etc/httpd/conf.d
mv welcome.conf welcome.conf.dist
vi proxy_ajp.conf
like,
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
ProxyPass / ajp://localhost:8009/lala/
ProxyPass /alt/ ajp://localhost:8009/alt/
 
Check/fix static name resolution and fqdn,
hostname --fqdn
vi /etc/hosts
 
Start and enable the daemon,
service httpd start
chkconfig httpd on
 
Refs.
http://linuxtips.castres-wireless.org/article.php3?id_article=85
http://www.howtoforge.com/forums/showthread.php?p=113304
 
 
References
http://byteworksinc.blogspot.com/
 

Last update: Apr 14, 2010