Installing Apache Tomcat on Ubuntu server

June 23rd, 2009 | Tags:

Here’s how to install Apache Tomcat version 5.5 on an Ubuntu machine (note that there is nothing Ubutu specific in these steps). This will form one of the foundation steps for a series of posts in which we will build a fully open-source business intelligence platform.

  1. First, install Java JDK. I am using Sun’s version mainly for stability and to avoid any compatibility issues.

    sudo apt-get install sun-java6-jdk

  2. Download Apache Tomcat and check for integrity.

    md5sum -c apache-tomcat-5.5.27.tar.gz.md5

  3. Unpack the archive file.

    tar xvzf apache-tomcat-5.5.27.tar.gz

  4. Move the unpacked directory to its permanent location. I use /opt but this is only a personal preference.

    sudo mv apache-tomcat-5.5.27 /opt

  5. Create a simple startup and shutdown script. Run sudo vi /etc/init.d/tomcat and save it with the following content:

    # Tomcat startup script

    export JAVA_HOME=/usr/lib/jvm/java-6-sun

    case $1 in
    sh /opt/apache-tomcat-5.5.27/bin/
    sh /opt/apache-tomcat-5.5.27/bin/
    sh /opt/apache-tomcat-5.5.27/bin/
    sh /opt/apache-tomcat-5.5.27/bin/
    echo "Usage: /etc/init.d/tomcat {start|stop|restart}"
    exit 1
    exit 0

  6. Don’t forget to make this script executable.

    sudo chmod 755 /etc/init.d/tomcat

  7. Now we can finally start Tomcat.

    /etc/init.d/tomcat start

  8. Finally, check that everything worked correctly by opening the Tomcat default page (http://<servername>:8080) in a web browser.
No comments yet.