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.

https://tomcat.apache.org/tomcat-8.5-doc/security-howto.html

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

 

Configure Tomcat

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 dirs…

Installing ubic.ping service…

Installing ubic.watchdog service…

Installing ubic.update service…

Installing cron jobs…

Installing /home/example/.ubic.cfg…

Starting ubic.watchdog…

Starting ubic.watchdog… started (pid 17719)

Installation complete.

Installed “ea-tomcat85” service.

Starting ea-tomcat85… started

… done!

To remove Tomcat support to a user, run the following command.

/usr/local/cpanel/scripts/ea-tomcat85 rem username

 

DEFAULT CONFIGURATION.

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:

autoDeploy

deployOnStartup

deployXML.

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, 

Was this answer helpful? 0 Users Found This Useful (0 Votes)