Picture of Brian Love wearing black against a dark wall in Portland, OR.

Brian Love

Simple Tomcat7 Install on Ubuntu 10

Here’s a quick and simple install guide for Tomcat7 on Ubuntu. I assume that you have already installed Ubuntu or have access to an Ubuntu instance. I am running Ubuntu in VMware Fusion. Let’s jump in.

Step One: Install JDK

$ sudo apt-get install default-jdk

Step Two: Install Tomcat 7

We are going to install the base tomcat7 package. We will also install the admin package so that the Tomcat manager is installed as well.

$ sudo apt-get install tomcat7
$ sudo apt-get install tomcat7-docs
$ sudo apt-get install tomcat7-admin
$ sudo apt-get install tomcat7-examples

Step Three: Configure bash

You will be adding the following two lines to the .bash_profile file.

export JAVA_HOME=/usr/lib/jvm/default-java
export CATALINA_HOME=/etc/tomcat7

To do this, we will use the nano editor. Fire it up via:

$ nano ~/.bash_profile

Step Four: Update permissions

Run the following commands to update the permissions for your tomcat7 group that was created when you installed the tomcat7 package in step one.

$ sudo chgrp -R tomcat6 /etc/tomcat7
$ sudo chmod -R g+w /etc/tomcat7

Step Five: Create admin user

Just like in step three we will be using the nano editor to make some additions to the tomcat-users.xml file. For this tutorial we will be creating a new admin user account. You can paste in the content below, or you can modify the example included in the file.

<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="admin" password="Pa$$w0rd" roles="manager-gui,admin-gui"/>

Step Six: Restart tomcat

After all of your changes have been made, restart the tomcat7 server.

$ sudo service tomcat7 restart

Step Seven: Log into manager

Open up your favorite web browser and browse to: http://localhost:8080/manager. Log into the website using the username and password you created in step five.