Saturday, February 12, 2011

Ubuntu: Install Tomcat

  1. Download the latest version of apache-tomcat from here.
  2. "cd /downloaded/directory" --> In terminal, go to the downloaded directory.
  3. "sudo cp apache* /usr/local" --> Copy the downloaded file to /usr/local (can be changed, I prefer local dir).
  4. "sudo chmod a+rwx apache*" --> change the access permissions.
  5. "sudo tar zxvf apache*" --> unzip the tar.gz file.
  6. "export JAVA_HOME=/usr/local/java/jdk1.6.0_17" --> set up JAVA_HOME env variable
  7. "export PATH=$JAVA_HOME/bin:$PATH" --> add java bin to path
  8. "export CATALINA_HOME=/usr/local/apache-tomcat-6.0.32" --> optional to set up these env variables.
  9. "cd $CATALINA_HOME/bin" --> go to bin folder to access scripts.
  10. "sudo sh startup.sh" --> to manually start Tomcat
  11. "localhost:8080" --> Go to browser and access the page to see configuration page of Tomcat.
  12. If step 11 returns error, "cd $CATALINA_HOME/logs" --> go to logs folder and view "catalina..log" file to see what went wrong. If everything went well, you should see "INFO: Starting Coyote HTTP/1.1 on http-8080". If you see "java.net.BindException: Address already in use", shutdown and restart Tomcat.
  13. "sudo sh $CATALINA_HOME/bin/shutdown.sh" --> to shutdown Tomcat.

Src: http://www.puschitz.com/InstallingTomcat.html#InstallingTomcatSoftware


EXTRA:

Mac: Installing Tomcat

src: http://developer.apple.com/internet/java/tomcat1.html

1. Download tomcat tar.gz from archives.
2. do sudo and extract it to /usr/local
3. give ownership to your username by chown -R username foldername
4. set up startup and stop scripts.
5. Access via localhost:8080 to check installation.