Install Apache Tomcat 5.5 on Ubuntu 8.04 Hardy

By | March 21, 2009

To install and run Tomcat on Ubuntu (8.04 over here) the following packages should be installed from synaptic :

1. tomcat5.5
2. tomcat5.5-webapps
3. sun-java6-jdk

They can be installed from command line using the command sudo apt-get

After synaptic finishes installing them open /etc/default/tomcat5.5 and edit it as follows :

Find :


Change : Remove the # so that it is uncommented.


It points to the java home which can be java-6-sun or any other java .

Then restart tomcat5.5 from command line like this :

[email protected]:~$ sudo /etc/init.d/tomcat5.5 restart
* Stopping Tomcat servlet engine tomcat5.5                              [ OK ]
* Starting Tomcat servlet engine tomcat5.5                              [ OK ]

Now open in your browser the url :


And the welcome page of Apache Tomcat should appear.

The file


has the default username and password listed which is username : tomcat and password : tomcat.

On the tomcat welcome page Tomcat Administration link is on the left :


Opening this page might show the error message :

HTTP Status 403 - Access to the requested resource has been denied

To fix the above issue open the file


sudo gedit /usr/share/tomcat5.5/conf/tomcat-users.xml

and add a role called admin and user called admin with that role :

<role rolename="admin"/>

<user username="admin" password="tomcat" roles="tomcat,admin"/>

Restart tomcat from command line as shown above.

Now log in to the administration panel :

with username : admin and password : tomcat.

The login should take you to the admin panel without any error.

To the left is another link of Tomcat Manager :

which might still show the error of Access denied.

To fix this issue simply login to the admin panel and create a role called manager (if it doesnt exist) and assign this role to a non-admin user like tomcat or create a new user.

Then log in to the Tomcat Manager page and it should open fine without any errors.

Now /usr/share/tomcat-webapps is the folder that contains the jsp files/webapps which are accessible from localhost:8180 url.

To change the directory of webapps to say one in /home/username/tomcat

Open : /usr/share/tomcat5.5-webapps/ROOT.xml

Look for :

Context path="/" docBase="/usr/share/tomcat5.5-webapps/ROOT"

and change the docBase value to the folder where the tomcat webapps would be.

Context path="/" docBase="/home/enlightened/tomcat"


Context path="/" docBase="/var/www/tomcat"

Save the file and restart tomcat.

One more thing you can do is copy the contents of the /usr/share/tomcat5.5-webapps/ROOT directory to this new directory and then open the url localhost:8180 to check that everything is working fine. The admin and manager pages on the left and the jsp examples also should all open fine as previously.

Last Updated On : 21st March 2009

One thought on “Install Apache Tomcat 5.5 on Ubuntu 8.04 Hardy

Leave a Reply

Your email address will not be published. Required fields are marked *