reset password

Setting Up Tomcat Without Admin Privilege

This guide describes how to set up Tomcat on a Linux server under a regular user account (i.e. no root or sudo privilege). It is intended for students who need to run their own Tomcat instances on shared servers like cs3 and csproject.

Download and Configuration

Download the zip or tar.gz file of the Core Tomcat binary distribution and unzip it under your account. It will create a new directory under your account, e.g. apache-tomcat-7.0.29, and we'll refer to this directory as $TOMCAT.

Edit $TOMCAT/conf/server.xml as follows:

  • Change the server port number from 8005 to a random number between 10,000 and 60,000. This is to avoid port conflicts with other Tomcat instances running on the same server.

<Server port="8005" shutdown="SHUTDOWN">

  • Change the HTTP connector port number from 8080 to a random number between 10,000 and 60,000, again, to avoid port conflicts.

<Connector port="8080" protocol="HTTP/1.1"

  • Comment out the AJP connector because you won't need it.

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Edit $TOMCAT/conf/tomcat-users.xml to add a user with the manager-gui role. This will allow you to use the web manager interface to deploy your applications.

Start and Stop the Server

To start the Tomcat server, run the script $TOMCAT/bin/, and to stop the server, run $TOMCAT/bin/

Deploy Application

First you need to package your application into a WAR file. If you use Eclipse, you can export a Dynamic Web Project into a WAR file. If you use Maven, you can run mvn package (or the equivalent in Eclipse if you use the m2eclipse plugin) which will create a WAR file under the /target folder of the project.

Use a browser to go to the address http://<host>:<port>, where <host> is the server address and <port> is the HTTP connector port number you specified in server.xml. Click on Manager App on the page and enter the username and password of the manager-gui user you specified in tomcat-users.xml. In the manager interface you can deploy an application by uploading the WAR file, and after that you should be able to access your application at http://<host>:<port>/<project>/.

This page has been viewed 9798 times.