In this article, we will understand the steps to install ea-Tomcat8.5 with private instances.
Here, all the instruction are given as you are logging into the server through the SSH access as the root user, or using WHM’s Terminal. (WHM> Server Configuration >Terminal).
In the example given below:
$username denotes the username which is linked with the particular cPanel account. If your cPanel’s account username is test1234, then:
The syntax for this is:
/home/$username/.bashrc
After entering the username, it looks like this
/home/test1234/.bashrc
Steps for Installing ea-Tomcat85
First, we need to install the ea-tomcat85 and the rng-tools packages.
To do so, enter the command given below:
yum install ea-tomcat85 rng-tools -y
Add Tomcat Support to an Account
Now, we have to add support for Tomcat to the accounts that needs it. Use the command given below to replicate every user that needs Tomcat:
/scripts/ea-tomcat85 add $username
After the above step is completed, you can then verify if the Tomcat is enabled.
/scripts/ea-tomcat85 list
The next step is to install Ubic. It basically manages the services in Tomcat.
1. Ubic Installation Process
Now, the installation of Ubic for cPanel user is simple. It needs the cPanel user to have shell access to the server which includes the write permissions to:
users/home/$username/.bashrc file
Enter the command into the shell/terminal while logged with root access after you replace the $username with the right username.
su - $username echo "export PATH=$(dirname $(readlink /usr/local/cpanel/3rdparty/bin/perl)):$PATH" >> /home/$username/.bashrc
You can skip the “su” command if you are accessing the SSH directly as a cPanel user.
a. For CloudLinux
If you are applying CloudLinux, then you also need to run the commands given below, from the root level, for adding Java to the CageFS mounts:
cagefsctl --addrpm tzdata-java cagefsctl --force-update
2. Testing
Once this is installed, you can then test that Ubic is running and Tomcat is enabled/installed with the command: (from the root level)
su - $username -s /bin/bash -c 'ubic status ea-tomcat85'
Configuration of Tomcat Environment
The Tomcat environment configuration is one of the most difficult part of the process. Apply the steps given below to configure the Tomcat environment.
1. Application Directory Configuration
Now, for enabling the ROOT webapp directory for testing, then add the entry to the section in the command:
/home/$username/ea-tomcat85/conf/server.xml file
This section starts with the deploy options, so this can be set below the line which contains autoDeploy, deployXML settings and deployOnStartup.
2. Verify the Environment
Before making any changes that can alter the configuration of Apache, it is advised to copy the test.jsp and call it directly to make sure the environment is operational.
egrep 'Connector port.*HTTP' /home/$username/ea-tomcat85/conf/server.xml
In order to copy the test script you would use the below command:
sudo -u $username cp -avp /opt/cpanel/ea-tomcat85/test.jsp /home/$username/ea-tomcat85/webapps/ROOT/
Once its completed, restart the Private Tomcat Instance for the user:
su - $username -s /bin/bash -c 'ubic restart ea-tomcat85'
Access “http://yourserverip:$PORT/test.jsp” with your preferred method, where $PORT is the port you previously determined, to verify test.jsp is operational. You should get a page with the following information on it:
Test JSP Page
This is a page to check that .jsp support has been enabled
3. Configuring the Proxypass
To configure the ProxyPass directive properly, you must first obtain the AJP connector port. The below command will help to restore the port info:
egrep 'Connector port.*AJP' /home/$username/ea-tomcat85/conf/server.xml
After you get the port, then you can create a ProxyPass Apache include file. Make sure you complete this action two times.
For the first time, perform it for http (std) and another for httos (ssl). Both of them uses similar approach as the Apache VHost includes. The path includes for http (std).
/etc/apache2/conf.d/userdata/std/2_4/$username/$domain.tld/tomcatproxypass.conf
And this file will look like this:
<IfModule proxy_ajp_module> Proxypass “/” “ajp://127.0.0.1:$PORT/” </IfModule>
Where $PORT is the value of the port which is recovered from the earlier command. Later, after you create the include files you should rebuild the Apache configuration and then restart the service.
/usr/local/cpanel/scripts/rebuildhttpdconf && /usr/local/cpanel/scripts/restartsrv_httpd
At last, confirm that the ProxyPass runs by loading up http://yourdomain1.tld/test.jsp in your chosen browser. You get the below output:
Test JSP Page
This is basically a page to check whether, .jsp support is enabled successfully.
After following all the above steps, you are now ready to install your application. All you need to do is, copy the application files into /home/$username/ea-tomcat85/webapps/ROOT/. Now, your application will load at yourdomain1.tld/.
Hope this article helps!