Install Apache Tomcat using EasyApache4
By Jithin on July 2nd, 2019
The Apache Tomcat is an Apache module that provides a web server in addition to the Apache web server for the Java Servlet, Java Server Pages, Java Expression Language, and Java Web Socket technologies. In cPanel/WHM version 76, they implemented a new version of Apache Tomcat for EasyApache4. Tomcat is supported in WHM version 76 and later.
Please note that Tomcat can present security issues with multiple users, so you must know the risk of the feature you are going to use. Please refer the following KB to more about tomcat security.
In this tutorial, we will show how to install and configure Tomcat. First, you will need to install the experimental repository on the server.
Install Experimental Repository
yum install ea4-experimental
For more about experimental repo, refer this document https://documentation.cpanel.net/display/EA4/The+Experimental+Repository
Install Apache Tomcat via WHM Interface
This is the method you would like to use if you don’t want to mess with Linux commands.
1) Login to WHM as a root user.
2) Go to WHM >> Software >> EasyApache 4 >> Additional Packages.
3) From there, click on the “Install” button next to the Tomcat.
Install Apache Tomcat via Command Line
You can also install Tomcat via command line on your server. Follow the below-given steps to install Tomecat via command line.
1) Login to the server through SSH as a root user.
2) Run the following command to install Tomcat.
yum install ea-tomcat85
3) To uninstall Tomcat, run the following command.
yum remove ea-tomcat85
Tomcat runs as a per-user private instance in EasyApache4. The default location of the configuration file is /home/user/ea-tomcat85/conf
Add Tomcat Support for Users.
In EasyApache 4, Tomcat runs as a per-user private instance and allows the user to configure their instance themselves.
There is a script to add a user in Tomcat
To add Tomcat support to a user, run the following command.
/usr/local/cpanel/scripts/ea-tomcat85 add username
Here is the sample output.
Adding example’s tomcat 8.5 instance …
Installing ubic.ping service…
Installing ubic.watchdog service…
Installing ubic.update service…
Installing cron jobs…
Starting ubic.watchdog… started (pid 17719)
Installed “ea-tomcat85” service.
Starting ea-tomcat85… started
To remove Tomcat support to a user, run the following command.
/usr/local/cpanel/scripts/ea-tomcat85 rem username
EasyApache4 makes the following configuration changes from the default Tomcat 8.5 behavior to the /home/user/ea-tomcat85/conf/server.xml file
1) Disable the shutdown port by default.
2) Set the “xpoweredBy” attribute of all connectors to a false value.
3) Add the “ErrorReportValue” class to all Hosts with the “showServerInfo” value set to a false value.
3) Set the following Host attributes to a false value:
You can also set the directives on your own. So, this is how you can install Tomecat with EasyApache4 on your CentOS server with WHM. We hope you liked the tutorial. If you want us to help you with any step, please use the comment section given below.