how to completely remove tomcat 7 from ubuntu 14.04

Dung picture Dung · May 30, 2017 · Viewed 30.5k times · Source

I search the web as to how remove tomcat7 on Ubuntu 14.04 completely 100% no config files etc ... leaving behind, but there is not one post to show how to step by step.

Answer

Dung picture Dung · May 30, 2017

Here is working/tested instruction:

1) list the packages of tomcat7

dpkg --get-selections | grep tomcat7

You may want to list as well packages tomcat like (dpkg --get-selections | grep tomcat) just in case.

2) remove all the packages you see! Only when you remove a single package -> pay attention at its dependencies if package A depend on B you will need to remove B and A together and in the order of B then A - An example of removing all packages as following:

root@dev:~# dpkg -P libtomcat7-java tomcat7 tomcat7-admin tomcat7-common tomcat7-docs tomcat7-examples

3) Ubuntu will not remove none-empty directories such as config files. So you will have to remove it manually. Search for the files left behind and remove them. Example:

find / -name "*tomcat7*"

Then remove them Example: rm -r /etc/tomcat7 /var/cache/apt/archives/tomcat7* /var/cache/apt/archives/libtomcat7* /tmp/hsperfdata_tomcat7

Done! All is cleaned out now.