Install Tomcat 7 on a cPanel Server

4.5/5 - (2 votes)

Update: cPanel is no longer supported by cPanel for CentOS 7 or newer. It is recommended that you use cpanel4j. The below instructions are no longer relevant for CentOS 6 or older servers, since cPanel now includes Tomat 7 in EasyApache 3.

CPanel has soon promised that Tomcat 7 will be supported in a future EasyApache release. Until then, you can get easily get the support of Tomcat 7 with just a little bit of manual intervention.  I will mention that right now, Tomcat 7 is not supported by cPanel so there’s no guarantee that their integrated features for Tomcat will work as expected.

 

First, go ahead and run EasyApache and select the option to install Tomcat. This will indeed install Tomcat 5.5, but that’s OK.  Let EasyApache do the grunt work for you.

 

After it’s installed, you’ll need to put the Tomcat 7 files in place:

cd /usr/local/jakarta

wget http://apache.claz.org/tomcat/tomcat-7/v7.0.41/bin/apache-tomcat-7.0.41.tar.gz

tar -xvzf apache-tomcat-7.0.41.tar.gz

ln -sf ln -sf /usr/local/jakarta/apache-tomcat-7.0.41 /usr/local/jakarta/tomcat

Note:  The above example is based off of the latest version of Tomcat available at this time.  You can get the latest version at http://tomcat.apache.org/download-70.cgi .

 

While still in the jakarta folder, compile the daemon:

cd ./tomcat/bin

tar -xvzf tomcat-native.tar.gz

cd commons-daemon-*

cd unix

./configure

make

cp jsvc ../../

Now kill off tomcat and restart it:

killall java

/scripts/restartsrv_tomcat

And add the latter command to /etc/rc.local:

sed ‘/starttomcat/d’ -i /etc/rc.local

echo ‘/scripts/restartsrv_tomcat’ >> /etc/rc.local

 

 

 

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Log in