How to completely remove tomcat 7 from ubuntu 14.04
Here is a working / tested instruction:
1) list tomcat7 packages
dpkg --get-selections | grep tomcat7
You may also need the tomcat package list (dpkg --get-selections | grep tomcat) just in case.
2) remove all packages you see! Only when removing one package -> pay attention to its dependencies, if package A depends on B, you will need to remove B and A together and in order of B, and A is an example of removing all packages like this:
root@dev:~# dpkg -P libtomcat7-java tomcat7 tomcat7-admin tomcat7-common tomcat7-docs tomcat7-examples
3) Ubuntu will not delete non-empty directories like config files. Therefore, you will have to remove it manually. Find the leftover files and delete 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! Everything is cleared now.
source to share