Tomcat7 Installation on firuta
1) Download Tomcat 7.
cd /tmp wget http://www.fightrice.com/mirrors/apache/tomcat/tomcat-7/v7.0.25/bin/apache-tomcat-7.0.25.tar.gz
2) Move and extract to the location you wish to install to.
tar -zxvf apache-tomcat-7.0.25.tar.gz sudo su mv apache-tomcat-7.0.25/ /usr/share/tomcat7
3) If you haven't already, create tomcat group and add tomcat user. The tomcat user should have /usr/share/tomcat as its home dir.
groupadd tomcat useradd -g tomcat -d /usr/share/tomcat tomcat usermod -G www-data tomcat
4) Now change ownership of the directories and create a symlink:
chown -R tomcat:tomcat /usr/share/tomcat7 ln -s /usr/share/tomcat7 /usr/share/tomcat
5) Now we create the init script (note that java home on firuta is at /usr/lib/jvm/java-6-sun-1.6.0.24).
cd /etc/init.d vi tomcat7
Paste the following contents into the file
### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO #!/bin/bash # description: Tomcat Start Stop Restart # processname: tomcat # chkconfig: 234 20 80 JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.24 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH CATALINA_HOME=/usr/share/tomcat case $1 in start) sh $CATALINA_HOME/bin/startup.sh ;; stop) sh $CATALINA_HOME/bin/shutdown.sh ;; restart) sh $CATALINA_HOME/bin/shutdown.sh sh $CATALINA_HOME/bin/startup.sh ;; esac exit 0
6) We want this script to start at system boot so we use the following to set executable permission and runlevel:
chmod 755 tomcat7 update-rc.d tomcat7 defaults
7) If migrating from tomcat6, copy war files and/or directories from the old webapps location to the new one. (On firuta, create a tomcat7webapps symlink in /var/www/ to the webapps dir in tomcat7)
cd /var/www/tomcat6webapps cp *.war /usr/share/tomcat7/webapps/ ln -s /usr/share/tomcat7/webapps/ ../tomcat7webapps
8) Start tomcat7!
/etc/init.d/tomcat7 start
9) See that http://firuta.huh.harvard.edu:8080 works. Now move the index.html from tomcat6 to tomcat7:
cd /var/www/tomcat7webapps cp /var/www/tomcat6webapps/ROOT/index.html ROOT/index.html cp ../tomcat7webapps/ROOT/index.html ROOT/index.html
10) Try out the filteredpush web client and see that it works.