Difference between revisions of "Tomcat"

From SME Server
Jump to navigationJump to search
m (categorisation)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Tomcat Installation and configuration
+
==Tomcat Installation and configuration==
Extracted from MasterSleepy http://www.vanhees.cc/index.php?module=ContentExpress&func=display&ceid=43
 
  
STEP 1: Download java jdk and upload it to your sme server
+
Extracted from MasterSleepy
 +
http://www.vanhees.cc/index.php?module=ContentExpress&func=display&ceid=43
  
Go to java.sun.com and download jdk
+
*<b>Download java jdk and upload it to your sme server</b>
For my example I use jdk-1_5_0_06-linux-i586-rpm.bin
+
 
 +
Go to [http://java.sun.com/javase/downloads/index.jsp java.sun.com] and download jdk
 +
For my example I use jdk-6-linux-i586-rpm.bin
 
ATTENTION: adapt all document jdk filename depending witch file you download
 
ATTENTION: adapt all document jdk filename depending witch file you download
  
STEP 2:  Install Java jdk
+
*<b>Install Java jdk</b>
  chmod a+x jdk-1_5_0_06-linux-i586-rpm.bin
+
  chmod a+x jdk-6-linux-i586-rpm.bin
  ./jdk-1_5_0_06-linux-i586-rpm.bin
+
  ./jdk-6-linux-i586-rpm.bin
  ln -s /usr/java/jdk1.5.0_06 /usr/java/jdk
+
  ln -s /usr/java/jdk1.6.0 /usr/java/jdk
After executing bin file, you can remove both file jdk-1_5_0_06-linux-i586-rpm.bin and jdk-1_5_0_06-linux-i586.rpm
+
After executing bin file, you can remove both file jdk-6-linux-i586-rpm.bin and jdk-6-linux-i586.rpm
  
STEP 3: Download tomcat last version
+
*<b>Download tomcat last version</b>
  
 
Go to Tomcat download website.
 
Go to Tomcat download website.
Download Core module apache-tomcat-5.5.17.tar.gz and Administration Web application apache-tomcat-5.5.17-admin.tar.gz
+
Download Core module apache-tomcat-6.0.14.tar.gz and Administration Web application apache-tomcat-5.5.23-admin.tar.gz
 
if you want another tomcat modules go here.
 
if you want another tomcat modules go here.
  wget http://apache.root.lu/tomcat/tomcat-5/v5.5.17/bin/apache-tomcat-5.5.17.tar.gz
+
  wget http://apache.root.lu/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.tar.gz
wget http://apache.root.lu/tomcat/tomcat-5/v5.5.17/bin/apache-tomcat-5.5.17-admin.tar.gz
 
  
STEP 4: Unpack archive
+
*<b>Unpack archive</b>
  
 
Unzip and move it
 
Unzip and move it
  tar -xvzf apache-tomcat-5.5.17.tar.gz
+
  tar -xvzf apache-tomcat-6.0.14.tar.gz
tar -xvzf apache-tomcat-5.5.17-admin.tar.gz
+
  mv apache-tomcat-6.0.14 /opt/
  mv apache-tomcat-5.5.17 /opt/
 
 
  cd /opt
 
  cd /opt
  ln -s apache-tomcat-5.5.17 tomcat
+
  mv apache-tomcat-6.0.14 tomcat
  
STEP 5: Create user and group
+
*<b>Create user and group</b>
 
  groupadd tomcat
 
  groupadd tomcat
 
  useradd -g tomcat -d /opt/tomcat tomcat
 
  useradd -g tomcat -d /opt/tomcat tomcat
Line 37: Line 37:
 
  chmod 770 /opt/tomcat/
 
  chmod 770 /opt/tomcat/
  
STEP 6: Create statup script
+
*<b>Create statup script</b>
 
Edit /etc/rc.d/init.d/tomcat with your favorite text editor, it should contain the following :
 
Edit /etc/rc.d/init.d/tomcat with your favorite text editor, it should contain the following :
  
Line 45: Line 45:
 
  #
 
  #
 
   
 
   
  NAME="Jakarta Tomcat 5"
+
  NAME="Jakarta Tomcat 6"
 
  TOMCAT_HOME=/opt/tomcat
 
  TOMCAT_HOME=/opt/tomcat
 
  CATALINA_HOME=/opt/tomcat
 
  CATALINA_HOME=/opt/tomcat
Line 70: Line 70:
 
     ;;
 
     ;;
 
  esac
 
  esac
 +
 +
exit 0
  
exit 0
+
*<b>Make startup script runable and make tomcat start automatically at boot</b>
 
 
STEP 7: Make startup script runable and make tomcat start automatically at boot
 
 
  chmod 755 /etc/rc.d/init.d/tomcat
 
  chmod 755 /etc/rc.d/init.d/tomcat
 
  ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc7.d/S98tomcat
 
  ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc7.d/S98tomcat
Line 80: Line 80:
 
  ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc1.d/K02tomcat
 
  ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc1.d/K02tomcat
 
  ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc0.d/K02tomcat
 
  ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc0.d/K02tomcat
 +
 +
End MasterSleepy HOWTO
 +
 +
Add MySQL Database Connector
 +
 +
  1. Download the MySQL Java Database Connector http://dev.mysql.com/downloads/connector/j/
 +
  2. Copy the JAR file into /opt/tomcat/lib
 +
 +
If you want to access Tomcat outside your local network, you must open port 8080 (or whatever you configured).
 +
 +
config set tomcat service access public status enabled TCPPort 8080
 +
signal-event remoteaccess-update
  
 
----
 
----
 
[[Category:Howto]]
 
[[Category:Howto]]
 +
[[Category:Administration]]

Latest revision as of 14:00, 11 May 2010

Tomcat Installation and configuration

Extracted from MasterSleepy http://www.vanhees.cc/index.php?module=ContentExpress&func=display&ceid=43

  • Download java jdk and upload it to your sme server

Go to java.sun.com and download jdk For my example I use jdk-6-linux-i586-rpm.bin ATTENTION: adapt all document jdk filename depending witch file you download

  • Install Java jdk
chmod a+x jdk-6-linux-i586-rpm.bin
./jdk-6-linux-i586-rpm.bin
ln -s /usr/java/jdk1.6.0 /usr/java/jdk

After executing bin file, you can remove both file jdk-6-linux-i586-rpm.bin and jdk-6-linux-i586.rpm

  • Download tomcat last version

Go to Tomcat download website. Download Core module apache-tomcat-6.0.14.tar.gz and Administration Web application apache-tomcat-5.5.23-admin.tar.gz if you want another tomcat modules go here.

wget http://apache.root.lu/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.tar.gz
  • Unpack archive

Unzip and move it

tar -xvzf apache-tomcat-6.0.14.tar.gz
mv apache-tomcat-6.0.14 /opt/
cd /opt
mv apache-tomcat-6.0.14 tomcat
  • Create user and group
groupadd tomcat
useradd -g tomcat -d /opt/tomcat tomcat
chown -R tomcat:tomcat /opt/tomcat/
chmod 770 /opt/tomcat/
  • Create statup script

Edit /etc/rc.d/init.d/tomcat with your favorite text editor, it should contain the following :

#! /bin/bash
#
# tomcat Start the tomcat server.
#

NAME="Jakarta Tomcat 6"
TOMCAT_HOME=/opt/tomcat
CATALINA_HOME=/opt/tomcat
JAVA_HOME=/usr/java/jdk
CATALINA_OPTS="-Dfile.encoding=iso8859-1"
TOMCAT_USER=tomcat
LC_ALL=en_US
export TOMCAT_HOME CATALINA_HOME JAVA_HOME CATALINA_OPTS TOMCAT_USER LC_ALL
cd $TOMCAT_HOME/logs
case "$1" in
  start)
    echo -ne "Starting $NAME.\n"
    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
    ;;

  stop)
    echo -ne "Stopping $NAME.\n"
    /bin/su $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
    ;;

  *)
    echo "Usage: /etc/init.d/tomcat {start|stop}"
    exit 1
    ;;
esac

exit 0
  • Make startup script runable and make tomcat start automatically at boot
chmod 755 /etc/rc.d/init.d/tomcat
ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc7.d/S98tomcat
ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc6.d/K02tomcat
ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc2.d/K02tomcat
ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc1.d/K02tomcat
ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc0.d/K02tomcat

End MasterSleepy HOWTO

Add MySQL Database Connector

  1. Download the MySQL Java Database Connector http://dev.mysql.com/downloads/connector/j/
  2. Copy the JAR file into /opt/tomcat/lib 

If you want to access Tomcat outside your local network, you must open port 8080 (or whatever you configured).

config set tomcat service access public status enabled TCPPort 8080
signal-event remoteaccess-update