Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to completely remove tomcat 7 from ubuntu 14.04

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.

like image 681
Dung Avatar asked Jan 03 '23 23:01

Dung


2 Answers

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.

like image 95
Dung Avatar answered Jan 29 '23 23:01

Dung


The answer by user Dung works as well on ubuntu 16/18. you may as well do:

find / -name "*tomcat*" | xargs rm -f

To delete the files without having to do it manually, make sure you are not on root on the first try. You may end up deleting something else. Maybe after checking what couldn't be deleted (root stuff), you may then do it on root or delete the files manually.

like image 34
Ismail Hachimi Avatar answered Jan 30 '23 00:01

Ismail Hachimi