Install Apache Tomcat under Ubuntu 10.10

The following steps are required to install Apache Tomcat under Ubuntu 10.10:

  1. install Sun Java JRE/SDK

    For guidelines see for instance http://www.mkyong.com/java/how-to-install-java-jdk-on-ubuntu-linux/.
  2. set PATH, CLASSPATH and JAVA_HOME (Ubuntu should set it automatically when installing Java:
    export PATH=$PATH:/usr/lib/jvm/java-6-sun/bin
    export JAVA_HOME="/usr/lib/jvm/java-6-sun"
    export CLASSPATH="/usr/lib/jvm/java-6-sun"
    

    Hint: In case you want to make this changes permanent and system-wide you could edit /etc/environment accordingly.

  3. download and unpack Apache Tomcat to for instance /opt/tomcat/
  4. start Apache Tomcat using:
    sudo /opt/tomcat/bin/startup.sh
    

    Tomcat should start with the following settings:

    Using CATALINA_BASE:   /opt/tomcat
    Using CATALINA_HOME:   /opt/tomcat
    Using CATALINA_TMPDIR: /opt/tomcat/temp
    Using JRE_HOME:        /usr
    Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar
    
  5. sometimes it is useful to change CATALINA_HOME to your local (NetBeans, Eclipse, etc.) workspace:
    export CATALINA_HOME="/home/xyz/workspace"
    
  6. activate Tomcat’s manager by creating a manager-user in tomcat-users.xml:
    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
      <role rolename="manager"/>
      <user username="admin" password="secret" roles="admin,manager"/>
    </tomcat-users>
    

Hint: When deploying using for instance NetBeans be sure that the current user has enough rights for the corresponding Tomcat working directory, e.g. /opt/tomcat/work/. This can be achieved with chown or chmod from within the shell.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *