Installation

Dependencies

Java Runtime

Full JDK not required

Tomcat 9 requires Java 8 or later

Tomcat 8 requires Java 7 or later

Tomcat 7 requires Java 6 or later

Tomcat Native for OpenSSL support

Installation options

Unpack an archive

Tomcat Installer for Windows

Package from Linux distribution

Build from source

Installing from an archive

.zip for Windows

.tar.gz for Linux, OSX etc

Contents is largely the same

Line endings vary

Tomcat Native binary for Windows is included in .zip

Demonstration

Installing from an archive

Windows

Linux

Exercise

Install from an archive

Display Tomcat home page in browser

File structure

bin/

File structure

conf/server.xml

Main configuration file

File structure

File structure

conf/web.xml

Global defaults for all web applications

Syntax defined by Servlet specification

Defines Default and JSP servlets

Can be over-ridden by web application

File structure

conf/context.xml

Global defaults for all web applications

Tomcat specific

Can be over-ridden by web application

File structure

conf/Catalina/localhost/*.xml

conf/<engine-name>/<host-name>/*.xml

Web-application specific configuration

Always over-rides context.xml in the web application

Name sets context path

File structure

conf/logging.properties

Logging configuration

Based on java.util.logging

Extended to be class loader aware

File structure

conf/tomcat-users.xml

Configures users for default Realm

Monitored for updates by default

XML schema file provided

File structure

conf/jaspic-providers.xml

Java Authentication Service Provider Interface for Containers

Plug-in authentication modules

Google OAuth most likely use

File structure

conf/catalina.properties

Sets system properties

Various Tomcat configuration options set at JVM level

Often used to change default globally but value can still be changed per web application

File structure

conf/catalina.policy

Used when running under a security manager

Only lightly tested

Few web applications work under a security manager out of the box

File structure

lib/

JAR files required by Tomcat

JARs added here will be visible to all web applications

File structure

logs/

Roll over daily except catalina.out

catalina.out - redirected console output

catalina.log - root logger (copied to console)

localhost_access_log - access log for default host

localhost.log - host log

manager.log, host-manager.log - web application log

File structure

temp/

Temporary file location used by the JVM

java.io.tmpdir

File structure

webapps/

Location of web applications

WARs or directories

Deployed automatically by default

File structure

work/

JSP compilation

Session serialization

Running as a Service

Windows

Runs as Local Service by default

(no password)

Running as a Daemon

You'll need build-essential

Expand in place, build and copy jsvc to bin

Copy daemon.sh to /etc/init.d/tomcat

Tomcat Installer for Windows

Unpacks archive

Creates a service

Automates the manual steps

Provides a GUI to set some basic options

Demonstration

Installing with the Tomcat Installer for Windows

Demonstration

Installing JSVC, the Linux service wrapper

Where did the files go?

Linux distributions have 'views' on file locations

Tomcat files not all in one location

Often use multiple packages

E.g.: Ubuntu 16.04 LTS and Tomcat 8.0.x

Tend to pick a version and then back-port fixes

Demonstration

Installing from a Linux package

Exercise

Install from the Installer for Windows

or

Install from a Linux package