> ## Content Index
> Fetch the complete content index at: https://scriptcrunch.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How To Deploy a Spring Webapp To Tomcat Server
- URL: https://scriptcrunch.com/how-to-install-and-setup-tomcat-on-ubuntu-server/
- Published: 2016-03-31T13:50:49.000Z
- Updated: 2026-06-23T08:56:20.000Z
- Author: Scriptcrunch Editorial
- Tags: #Migrated-1758801465347, #wp, #wp-post, #Import 2025-09-25 11:57

This [tutorial](https://scriptcrunch.com/tag/tutorials/) will [guide](https://scriptcrunch.com/tag/guides/) you through the steps for deploying a plain spring web application to a tomcat server.

If you haven't setup Tomcat server, you can follow the steps given below to set it up on a Ubuntu server.

### Setting Up tomcat7 on Ubuntu

All the required steps for the configuration and setup is given below.

1. Update the server.

```bash
sudo apt-get update
```

1. Install Tomcat7 from the repository.

```bash
sudo apt-get install tomcat7
```

1. Open /etc/default/tomcat7 and find JAVA\_OPTS and replace the default value with the following.

```bash
JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC"
```

1. Now, restart the tomcat service.

```bash
sudo service tomcat7 restart
```

1. Now if you [go](https://scriptcrunch.com/tag/go/) to localhost:8080 you can see the default tomcat7 web page saying "It Works".

### Install Maven To Build the Project

You need some build tool to build the project and create a war file for deployment. If you dont have maven installed, install maven using the following command.

```java
sudo apt-get install maven
```

## Deploying Spring Web App To Tomcat Server

Now you have tomcat and a build tool ready. Also, you might have your project file with the pom.xml file for maven.

1. cd in your project folder where you have the pom.xml file and run the following command.

```bash
mvn clean install
```

2\. Once the project is built, you can get the war file from the target direcory in your project folder. Copy the tar file to /var/lib/tomcat7/webapps directory.

1. Restart the Tomcat server using the following command.

```bash
sudo service tomcat7 restart
```

1. Thats it ! Your app is not deployed.

Now if you visit, <server ip>:8080/appname, you can view your running app.