Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This guide covers downloading and installing Tomcat 8 on an Ubuntu Linux 9 on a linux server.

Prerequisites

...

You can login as a non-root user with sudo access.

You have installed Java, with the required settings.

Instructions

Step 1  Create Tomcat user

Warning

Do not run Tomcat as root as this constitutes a security risk.

...

Code Block
sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat

Step 2  Download and

...

install Tomcat 

Excerpt
  1. Download

    1. To find the latest version

...

    1. , go to the

...

    1. Tomcat downloads page:
    2. Find the latest Binary Distributions section, then the Core sub-heading, and copy the tar.gz link.

Download Tomcat

...

    1. To download Tomcat, on the Linux server, go to the tmp directory

...

    1. . Use the curl command to download from

...

    1. the the tar.gz link.

      Code Block
      cd /tmp
      curl -O http://mirror.ox.ac.uk/sites/rsync.apache.org/tomcat/tomcat-
8
    1. 9/
v8
    1. v9.
5
    1. 0.
11
    1. 38/bin/apache-tomcat-
8
    1. 9.
5
    1. 0.
11
    1. 38.tar.gz


  1. Install

...

    1. Unpack the

...

    1. Tomcat tar.gz file

...

    1. into /opt/tomcat.

      Code Block
      sudo mkdir /opt/tomcat
      cd /opt/tomcat
      sudo tar xvf /tmp/apache-tomcat-
8
    1. 9*tar.gz --strip-components=1


      This

...

    1. creates the tomcat folders (conf, logs, webapps etc.) directly under /opt/tomcat.

...

    1. Set the file ownership and permissions.

      Code Block
      cd /opt/tomcat
      sudo chown -R tomcat webapps/ work/ temp/ logs/
      sudo chgrp -R tomcat .
      sudo chmod -R g+r conf
      sudo chmod g+x conf


Step 3  Create a service wrapper

This stage step creates a wrapper which that allows tomcat Tomcat to be managed as a service; this allows tomcat to be stopped and started . Using a service means you can stop and start Tomcat reliably, and ensures that the running environment (e.g. the starting directory) is well defined.

Specifically, these These instructions create a systemd service.

First, create a service definition file:

...