Removing a package and related files/folders, then re-adding tomcat caused some issues

So I was playing around with a ubuntu 11 VPS, and I installed tomcat using apt-get, and after some time I messed something up, and instead of figuring out the issue I thought I could just remove the package and start over.

sudo apt-get remove tomcat6

I noticed when I removed the package, the folders that tomcat used were still around, so I deleted them:

/etc/tomcat6
/var/lib/tomcat6/
/usr/share/tomcat6

When I tried to install the package again, there were some errors as it was trying to look for files in I believe /usr/share/tomcat6 (I don't recall now).

Did I miss a step or something, shouldn't have this theoretically worked?


For what is worth, here is your answer:

sudo apt-get purge [package]
sudo apt-get install <package> --reinstall

You can remove tomcat using terminal in Ubuntu with these very simple steps:

Step 1: Find all packages related with tomcat

dpkg -l|grep tomcat 

Step 2: Remove desired tomcat package

sudo dpkg -P (package you want to delete)