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)
2 comments:
if you do this, the tomcat uses the jdk of 32bit to start itself,but in your article it is of 64bit, why? its' process is using the JAVA_HOME and adding the string of "bin/java" int the setclasspath.sh file. please contact me sunyanan8@126.com thinks!
Hello dear!
Sorry for the late reply since I was busy with testing, kids and bla..bla..
OK..regarding to your question on the tomcat using 32bit or 64 bit..when I type java -version to my system it shows me "Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)". So as I went thru some reading, if u want your tomcat using 64bit, just specify the parameter of -d64 in the .profile. Besides, I did some try and error by changing the JAVA_HOME value from JAVA_HOME=/usr/jdk/jdkx.xx.xx to JAVA_HOME=/usr/jdk/jdkx.xx.xx/bin/sparcv9/java (which is the symbolic link to /usr/bin/java)...but no luck..I can't restart my tomcat. I would like to hear from you if you have any opinion on this. You may refer to this link:
http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#64bit_selection
Cheers
Dina
Post a Comment