Install Apache Tomcat using EasyApache4
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,¬†