Apache Tomcat or simply Tomcat (formerly it was also known as Jakarta Tomcat) is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat can be installed on CentOS/Redhat machine either using yum or from the source file. However, in this article, we will see, how we can uninstall/remove tomcat from the Linux machine.
In order to remove tomcat from your machine, the first thing you need to check is how this package got installed on your server.
Removal of Tomcat installation through package manager
Suppose, you have installed tomcat5 using “yum” package manager, then the default tomcat configurations can be found at “/etc/tomcat5” and “/usr/share/tomcat5”. You can find the tomcat packages using the following command:
# rpm –qa | grep tomcat
Now, you can proceed with uninstallation of the listed packages using “yum” as follows:
# yum remove tomcat5
# yum remove tomcat5-webapps
# yum remove tomcat5-admin-webapps
Continue this for the other packages. Packages such as tomcat5-servelet may have many dependencies including open office. So, if you want to remove the packages without removing the dependencies, you need to use the command “rpm” as follows:
# rpm –e package_name –nodeps
After removing the packages, you need to remove the tomcat directories too:
# rm –rf /etc/tomcat5
# rm –rf /usr/share/tomcat5
Removal of Tomcat source file installation
In this case, you need to stop tomcat and remove all the binaries from the server.
1. To stop tomcat
2. To remove tomcat binaries and folders
#rm -f /usr/sbin/startomcat
#rm -f /usr/sbin/stoptomcat
#rm -Rf /usr/local/jakarta
3. To remove from “chkservd” (if it is configured there)
# service chkservd stop
#rm -Rf tomcat
rm -Rf Tomcat_JSP
#service chkservd start
4. To remove Tomcat Connector configuration from Apache web server
Remove all mod_jk lines from httpd.conf, including addmodule, loadmodule, and include lines.
- How to Install Tomcat 8 on Ubuntu 16.04 (Multiple Instances)
- How to Install Apache Tomcat 8.0.x on Linux