Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm experimenting with Java web development, and it seems that I've messed up with my current tomcat6 installation, especially its configuration files.

How to recover tomcat6 to its original state as if it was freshly installed?

PS: Re-installing it (via apt-get) doesn't seem to work!

share|improve this question
up vote 2 down vote accepted

I assume just deinstalling tomcat6 doesn't remove the config files that are placed in /etc/tomcat6. So you will have to purge tomcat6 using sudo apt-get purge tomcat6 before re-installing the package. Additionally, there may be cached files in /var/cache/tomcat6 that may affect a reinstall, so you should check that directory before reinstalling, too.


If purging tomcat's config doesn't solve the problem, there may be more causes for tomcat stopping to work, e.g. a messed-up java setup. To check this, the easiest way is to install a second JRE (OpenJDK, for example), modify the alternatives so the newly-installed JDK is used (sudo update-alternatives --config java), and restart tomcat. If this works, the problem is likely caused by the config of the previously used JRE/JDK.

If it doesn't work, more information about tomcat's malfunction are required: details about tomcat's behaviour, error messages when running tomcat manually from the command line, contents of tomcat's logs (catalina.out and so on).

share|improve this answer
Sorry, didn't work! – wassimans Jan 6 '12 at 18:00
Your suggestions. I purged, checked for cached files in /var/cache/ and totally uninstalling all tomcat6 packages and then re-installing them. – wassimans Jan 6 '12 at 19:17
Honestly I can't think of a solution. The config files are as I left them (modified) after the fresh install (as you suggested). – wassimans Jan 7 '12 at 6:09
@Wassim: i've amended my answer how to proceed if installing tomcat freshly doesn't work, and removed my other comments. – tohuwawohu Jan 7 '12 at 8:57

Better you completely remove the tomcat6 from your system.

To remove completely tomcat6 do the following steps:

dpkg -l | grep tomcat

to list all packages related with tomcat in your system.

Now you can use

sudo dpkg -P packageName

where packageName is the name of package you get from the first step (second column).

This should firmly purge your tomcat from the system, but if it doesn't - give me a sign, and we will try something more :-)

After you successfully remove tomcat6, re-install it using apt-get

share|improve this answer
+1 for the advice to use dpkg -l! – tohuwawohu Jan 6 '12 at 16:32
Didn't work :-) – wassimans Jan 6 '12 at 18:05
What happened? can u give the output when you are trying to install tomcat6 again? Were you able to successfully remove tomcat6? – Rajesh Pantula Jan 6 '12 at 18:08
Absolutely, I've successfully removed tomcat6 without any bizard output. Weared! – wassimans Jan 7 '12 at 6:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.