Ubuntu 8.04 LTS + openjdk6 + apache-tomcat-6.0.18

Prerequisites
• Ubuntu 8.04 (you can try with other ubuntu/debian, with other OS you have to install JVM in a different way)
Needed files:
• apache-tomcat-6.0.18.zip from http://tomcat.apache.org/download-60.cgi

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt-get install openjdk-6-jdk

unpack apache-tomcat-6.0.18.zip where you want (i used /usr/local/tomcat, change the following commands accordingly if you have used a different directory)

set JAVA_HOME environment variable:

  1. JAVA_HOME=/usr/lib/jvm/java-6-openjdk
  2. export JAVA_HOME

start the server:

  1. /usr/local/tomcat/bin/startup.sh

and try to navigate http://localhost:8080
stop the server:

  1. /usr/local/tomcat/bin/shutdown.sh

if you need the init.d script use this (this automatically sets JAVA_HOME)

  1. sudo nano /etc/init.d/tomcat

copy and paste the following

  1.    # Tomcat auto-start
  2.     #
  3.     # description: Auto-starts tomcat
  4.     # processname: tomcat
  5.     # pidfile: /var/run/tomcat.pid
  6.  
  7.     export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
  8.  
  9.     case $1 in
  10.     start)
  11.             sh /usr/local/tomcat/bin/startup.sh
  12.             ;;
  13.     stop)  
  14.             sh /usr/local/tomcat/bin/shutdown.sh
  15.             ;;
  16.     restart)
  17.             sh /usr/local/tomcat/bin/shutdown.sh
  18.             sh /usr/local/tomcat/bin/startup.sh
  19.             ;;
  20.     esac  
  21.     exit 0

make it executable

  1. sudo chmod +x /etc/init.d/tomcat

then you can start/stop/restart tomcat in this way

  1. /etc/init.d/tomcat start
  2. /etc/init.d/tomcat stop
  3. /etc/init.d/tomcat restart

and if you want to run at boot time run this command:

  1. update-rc.d tomcat defaults

i suggest to add a default user changing the password for the tomcat admin page, to do this, edit the file:

  1. sudo nano /usr/local/tomcat/conf/tomcat-users.xml

and add in the node the following:

  1. <role rolename=”manager”/>
  2. <user username=”manager” password=”password” roles=”manager”/>

follow this guide to run zk on this tomcat freshly installation

2 Responses to “Ubuntu 8.04 LTS + openjdk6 + apache-tomcat-6.0.18”


  1. 1 leorockway

    Thank you, this was very useful.

  2. 2 Riccardo

    glad to see that helps

Leave a Reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image