# Installing and configuring the Tomcat server

1. Install the Tomcat server using the following commands:

```
wget http://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.28/bin/apache-tomcat-8.5.28.tar.gz
tar - xvf apache-tomcat-8.5.28.tar.gz
mv apache-tomcat-8.5.28 tomcat8
```

&#x20;2\. Configure Java and Tomcat using the following steps:

a. Go to \<tomcat home>/bin.

b. In the Catalina.sh file, enter the following commands:

```
export JAVA_HOME= <jdk home>/jdk1.8.x
CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=512m -Xms4096m -Xmx4096m"
CATALINA_PID= <tomcat home>/bin/catalina.pid
```

{% hint style="danger" %}
The values passed for *"CATALINA\_OPTS"* will vary based on the memory allocation.
{% endhint %}

{% hint style="warning" %}
Under <$TOMCAT\_HOME>/conf/, in the Server.xml file, do not change the default values for maxThreads and minSpareThreads (200 and 10 respectively).
{% endhint %}

&#x20;3\. Under the $TOMCAT\_HOME/lib folder, create a file **log4j.properties** containing the following code:

```
# Global logging configuration
log4j.rootLogger=warning, R
log4j.logger.com.rapapp.platform.server=error
log4j.logger.com.rapapp.platform.server.script=error
log4j.logger.com.rapapp.platform.server.rest=error
log4j.logger.com.ibatis=error
log4j.logger.java.sql=error
log4j.logger.org.quartz=error
log4j.logger.org.apache=error
log4j.logger.org=error
log4j.logger.com.rapapp.platform.installer=error
log4j.logger.io.cloudio=error
# Console output
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{DATE} %5p %c{1}:%L - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=../logs/ra.log
log4j.appender.R.MaxFileSize=10240KB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{DATE} %5p %c{1}:%L - %m%n
```

&#x20;4\. Go to $TOMCAT\_HOME/Conf/ and in the server.xml file, enable

compression using the following lines of code:

```
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
compression="on" compressionMinSize="8192" useSendfile="false" compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript"
redirectPort="8443" />
```

{% hint style="warning" %}
If useSendfile is set to ‘false’, then any compression that Tomcat may have otherwise performed on the response will be disabled.
{% endhint %}

&#x20;5\. Deploy the WAR file using the following steps:

* Run the following command: *cd tomcat8/webapps/*
* Backup the existing WAR file, if any, and delete it.
* Move the CloudIO WAR file into the webapps folder and rename it as ROOT.war.
* Run the following command: *cd $TOMCAT\_HOME/bin/*
* Start the Tomcat server using the following command: *./startup.sh*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudio.io/setting-up-the-cloudio-platform/platform-installation/installing-the-servers/installing-and-configuring-the-tomcat-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
