Knowledge Base

Installing Terminalfour on Windows using Apache Tomcat

Last Modified:
10 May 2021
User Level:
Administrator

This guide is divided into two parts. The first part outlines the installation of Apache Tomcat on a Windows system. The second part explains how to install the Terminalfour software once you Apache Tomcat server has been configured. 

Installing Apache Tomcat 9

If you haven't already done so, download the 32-bit/64-bit Windows Service Installer for Apache Tomcat 9, this is available from the download page. There are other installers available, but this particular installer will create the Windows service for Apache Tomcat for you.

  1. Run the installer and follow the screens until the Choose Components screen:

    Screenshot of Tomcat 9 Choose Components
     
  2. The only necessary component is the "Tomcat" component; however, it may prove useful to install the standard options (selected by default). If your machine is open to the internet on port 8080, it is best to only install the Tomcat component. Continue to the next screen after selecting your components.
  3. This screen allows you to define the port on with Tomcat will listen as well as a username and password for the Tomcat Manager component application (if you chose to install this). It is preferred to leave Tomcat listening on port 8080 for HTTP:

    Screen of Tomcat 9 Configuration screen
     
  4. You will now be asked to select your Java Virtual Machine or JVM. Your system's default JVM should be picked up automatically; however, you can change this to another JVM instance if you wish.

    Only Oracle Java 11 is supported by Terminalfour 8.3+Once selected, follow the screens until Tomcat has been installed:

    The Java VM Path Selection screen in Tomcat 9 installation
     
  5. The next screen will ask you where you would like to install Tomcat. Any file system location is fine. Once you have chosen your directory, go to the next screen:
    Tomcat 9 Choose Install Location

Post Installation Configuration of Tomcat 9

Setting the Tomcat process to start automatically

If you chose the installer package outlined above, a Windows service would have been created during the installation process. This process should be set to run automatically when the system starts:

  1. To open the Windows Services control panel, Go to Start and search for "View Local Services".
  2. Locate the process for Tomcat 9 in the list, then right-click and select properties. A new window opens:

    Tomcat 9 installation Services screen
     
  3. On the General tab, change the process's Startup type to Automatic. You should also start the process if you have not already done so:

    The general tab of the Tomcat 9 installation properties screen
     
  4. On the Log On tab, you can change the user Tomcat runs as. This is only necessary if you plan to publish your website to a file share. To change the user, select This Account and then enter an appropriate username and password for that shared location.

Changing the Java memory parameters for Tomcat

When Tomcat is installed, it will only run with a default memory allocation. It is recommended that this memory allocation is altered to at least 2 gigabytes and if possible 4 gigabytes:

  1. Open the Configure Tomcat application. If Tomcat is running, you should have an item in the system tray for Tomcat which you can right-click on and select Configure. Otherwise, open the folder you have installed Tomcat in, then run the program "tomcat9w.exe" which will be in the bin folder.
  2. On the Java tab, you can specify the memory allocations for Java. Have a look at the recommended memory allocation settings in this article.
  3. Java Environment Variables can also be set from this menu under Java Options. Our recommended Environment Variables are:
    -Djava.util.Arrays.useLegacyMergeSort=true
    -Djava.awt.headless=true
    -XX:-OmitStackTraceInFastThrow
    These should be added below the default options:
    Te Java tab of the Tomcat 9 Properties Screen
     
  4. Select Apply to save your changes.
  5. Switch back to the General tab and then Stop and Start Tomcat to ensure your memory settings are okay.

Verify your Tomcat installation

To quickly check that Tomcat has installed without error and is running, navigate to http://localhost:8080/ where you should see the default home page for Tomcat:

Screenshot of the Tomcat 9 download screen

Setting Up Terminalfour in Apache Tomcat 9

To set up Terminalfour you need to do the following:

Create a folder structure for Terminalfour

It is recommended the following folders are created as outlined in the image below.

The main Terminalfour folder can be placed anywhere on your file system, this guide assumes it is located on the C drive as C:\Terminalfour\

filestoreStores all media files that are added to Terminalfour

ItemDescription
servlets Stores the main Terminalfour WAR file
temp Can be set as the temporary file directory for Terminalfour
changesets Should be used to hold the changeset directories for Transfer Manager
preview Directory used for setting up a preview filter
publish-transfer-logs Can be used to store achived publish/transfer logs

TERMINALFOUR Folder Structure Windows

After creating the folder structure, place your Terminalfour WAR file into the servlet's directory.

Add the JDBC driver for your database into Tomcat

The JDBC driver for your database should be placed into the lib folder of your Tomcat installation. This is a JAR file that will be specific to your database type and version. For Oracle systems we recommend the use of the Oracle Thin JDBC Driver; however, the OCI driver will work.

You can see the list of supported databases here.

Configure Tomcat's server.xml file for Terminalfour

We need to tell Tomcat where to find the Terminalfour files and how to run them. This is done by editing the server.xml file located in the conf folder for your Tomcat installation. Open this file for editing and add in the following code towards the bottom of the file just before the </host> tag. There are three resources available below; please use the resource which is appropriate for your system and remember to edit any information in bold to match your particular setup.

The path indicated in bold needs to be changed to match the path to your WAR file.

For Terminalfour Version 8.3+, we advise that there are 200 connections available to the database.

MySQL:

<Context path="/terminalfour"
docBase="/usr/share/tomcat9/webapps/servlets/terminalfour-8.3.9-FINAL.war"
reloadable="false"
antiJARLocking="true">

<Resource driverClassName="com.mysql.jdbc.Driver"
                    maxActive="200"
                    maxIdle="20"
                    name="jdbc/SiteManagerDB"
                    username="DATABASE_USER"
                    password="DATABASE_PASSWORD"
                    type="javax.sql.DataSource"
                    url="jdbc:mysql://DATABASE_HOST/DATABASE_NAME?zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&useSSL=false"
                    validationQuery="SELECT 1"
                    maxWait="-1"
                    removeAbandoned="true"
                    removeAbandonedTimeout="600"
                    minEvictableIdleTimeMillis="600000"
                    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
                    jdbcInterceptors="ResetAbandonedTimer"
                    logAbandoned="true"
                    testOnBorrow="true"
                    testOnReturn="true"
                    testWhileIdle="true"
                    timeBetweenEvictionRunsMillis="1200000" />
</Context>

Microsoft SQL Server:

<Context path="/terminalfour"
docBase="/usr/share/tomcat9/webapps/servlets/terminalfour-8.3.9-FINAL.war"
reloadable="false"
antiJARLocking="true">

          <Resource driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
                    maxActive="200"
                    maxIdle="20"
                    name="jdbc/SiteManagerDB"
                    username="DATABASE_USER"
                    password="DATABASE_PASSWORD"
                    type="javax.sql.DataSource"
                    url="jdbc:sqlserver://DATABASE_HOST;DatabaseName=DATABSE_NAME"
                    validationQuery="SELECT 1"
                    maxWait="-1"
                    removeAbandoned="true"
                    removeAbandonedTimeout="600"
                    minEvictableIdleTimeMillis="600000"
                    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
                    jdbcInterceptors="ResetAbandonedTimer"
                    logAbandoned="true"
                    testOnBorrow="true"
                    testOnReturn="true"
                    testWhileIdle="true"
                    timeBetweenEvictionRunsMillis="1200000" />
</Context>

Oracle (assuming Oracle Thin JDBC client):

<Context path="/terminalfour"
docBase="/usr/share/tomcat9/webapps/servlets/terminalfour-8.3.9-FINAL.war"
reloadable="false"
antiJARLocking="true">

          <Resource driverClassName="oracle.jdbc.driver.OracleDriver"
                    maxActive="200"
                    maxIdle="20"
                    name="jdbc/SiteManagerDB"
                    username="DATABASE_USER"
                    password="DATABASE_PASSWORD"
                    type="javax.sql.DataSource"
                    url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DATABSE_HOST)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=SCHEMA)))"
                    validationQuery="SELECT 1"
                    maxWait="-1"
                    removeAbandoned="true"
                    removeAbandonedTimeout="600"
                    minEvictableIdleTimeMillis="600000"
                    factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
                    jdbcInterceptors="ResetAbandonedTimer"
                    logAbandoned="true"
                    testOnBorrow="true"
                    testOnReturn="true"
                    testWhileIdle="true"
                    timeBetweenEvictionRunsMillis="1200000" />
</Context>

Save your server.xml file and restart Tomcat using the Windows Services control panel. You should now be able to access Terminalfour by navigating to http://localhost:8080/terminalfour/SiteManager in your web browser. This will present you with the screen.

Go to Step 3 – Terminalfour Installation

Back to top