1) Install jdk6 + jre6 + tomcat 6 and edit .profile
-->JAVA_HOME=/usr/jdk/jdk1.6.0_23
-->CATALINA_HOME=/opt/apache-tomcat-6.0.30
-->PATH=$PATH:$JAVA_HOME/bin
-->JAVA_OPTS="-server -Xmx4096m -d64"
-->export JAVA_HOME CATALINA_HOME PATH JAVA_OPTS
-->logout
2) Test tomcat by typing http://
3) To use tomcat manager, edit tomcat-users.xml
-->under
4) At OS side, create group
-->#groupadd icts
5) Create user
-->#useradd -g icts -d /opt/apache-tomcat-6.0.30/developer -ms /bin/bash developer
-->#passwd developer (the password is dev123)
6)Edit the .profile in user home dir
-->JAVA_HOME=/usr/jdk/jdk1.6.0_23
-->CATALINA_HOME=/opt/apache-tomcat-6.0.30
-->PATH=$PATH:$JAVA_HOME/bin
-->JAVA_OPTS="-server -Xmx4096m -d64"
-->export JAVA_HOME CATALINA_HOME PATH JAVA_OPTS
7)logout
8)echo all the export value
9)Change group
-->#chgrp -Rf icts /opt/apache-tomcat-6.0.30 (done by root)
(so dir apache-tomcat-6.0.30 owner is root and group is icts)
10)Change mod
-->#chmod -Rf 775 /opt/apache-tomcat-6.0.30 (done by root)
(r-w-x permission both for owner and group)
11) Try to stop and start the tomcat by using developer account
(when you do ls -la to /opt/apache-tomcat-6.0.30 you should see the owner is root and the group is icts)
SCRIPT
To stop tomcat 6 (tomcatstop):
#!/bin/sh
#name is the variable
JAVA_HOME=/usr/jdk/jdk1.6.0_23
CATALINA_HOME=/opt/apache-tomcat-6.0.30
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME CATALINA_HOME PATH
name="This is to stop Tomcat Service!"
echo "$name"
cd $CATALINA_HOME/bin
./shutdown.sh
To start tomcat 6 (tomcatstart):
#!/bin/sh
#name is the variable
JAVA_HOME=/usr/jdk/jdk1.6.0_23
CATALINA_HOME=/opt/apache-tomcat-6.0.30
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME CATALINA_HOME PATH
name="This is to start Tomcat Service!"
echo "$name"
cd $CATALINA_HOME/bin
./startup.sh
Put both script in ~home dir/script (owner: developer group:icts) and also in /script (root)(owner:root group:icts)
________________________________________________
HOW TO START/STOP TOMCAT6 UPON REBOOT
#cp -r /script/tomcatstop /etc/init.d/tomcatstop
#cp -r /script/tomcatstart /etc/init.d/tomcatstart
#chmod +x /etc/init.d/tomcatstop
#chmod +x /etc/init.d/tomcatstart
#ln -s /etc/init.d/tomcatstop /etc/rc0.d/K01tomcatstop
#ln -s /etc/init.d/tomcatstop /etc/rc2.d/K01tomcatstop
#ln -s /etc/init.d/tomcatstart /etc/rc2.d/S90tomcatstart
#ln -s /etc/init.d/tomcatstop /etc/rc3.d/K01tomcatstop
#ln -s /etc/init.d/tomcatstart /etc/rc3.d/S90tomcatstart
HOW TO ALLOW NON-ROOT USER TO RUN TOMCAT ON PORT 80 (port <1024 only can be run by root)
#usermod -K defaultpriv=basic,net_privaddr developer
(done by root. This will be written in /etc/user_attr file)