When you have installed tomcat by using Easy-Apache then it installed Tomcat 5.5 and if you want to installed Tomcat 7.0.11 then you need to made some necessary changes on the server.
1) First install Tomcat 5.5 by using Easy-Apache means java is also installed at the time of Easy-Apache. The Tomcat 5 is installed in
/usr/local/jakarta/
directory with the symbolic link tomcat
. For example:[~]# ll /usr/local/jakarta
drwxr-xr-x 4 tomcat nobody 4096 Apr 5 17:15 ./
drwxr-xr-x 22 root root 4096 Mar 5 15:39 ../
drwxr-xr-x 12 tomcat nobody 4096 Apr 4 17:02 apache-tomcat-5.5.30/
lrwxrwxrwx 1 tomcat nobody 39 Apr 4 17:04 tomcat -> /usr/local/jakarta/apache-tomcat-5.5.30/
2) Then download and extract Tomcat 7 in
/usr/local/jakarta
directory[~]# cd /usr/local/jakarta
[/usr/local/jakarta]# wget http://apache.cs.utah.edu/tomcat/tomcat-7/v7.0.11/bin/apache-tomcat-7.0.11.tar.gz
[/usr/local/jakarta]# tar -xzvf apache-tomcat-7.0.11.tar.gz
3) Then Change the tomcat symbolic link to point to your new version (i.e.
/usr/local/jakarta/apache-tomcat-7.0.11
)[/usr/local/jakarta]# rm tomcat
[/usr/local/jakarta]# ln -s /usr/local/jakarta/apache-tomcat-7.0.11 tomcat
Now it shows
[~]# ll /usr/local/jakarta
drwxr-xr-x 4 tomcat nobody 4096 Apr 5 17:15 ./
drwxr-xr-x 22 root root 4096 Mar 5 15:39 ../
drwxr-xr-x 12 tomcat nobody 4096 Apr 4 17:02 apache-tomcat-5.5.30/
drwxr-xr-x 9 tomcat nobody 4096 Apr 4 17:01 apache-tomcat-7.0.11/
lrwxrwxrwx 1 tomcat nobody 39 Apr 4 17:04 tomcat -> /usr/local/jakarta/apache-tomcat-7.0.11/
4) Then compile the new Tomcat version on cPanel server.
[~]# cd /usr/local/jakarta/apache-tomcat-7.0.11
[/usr/local/jakarta/apache-tomcat-7.0.11]# cd ./bin
[/usr/local/jakarta/apache-tomcat-7.0.11/bin]# tar xvfz commons-deamon-native.tar.gz
[/usr/local/jakarta/apache-tomcat-7.0.11/bin]# cd commons-daemon-1.0.x-native-src/unix
[/usr/local/jakarta/apache-tomcat-7.0.11/bin/commons-daemon-1.0.x-native-src/unix]# ./configure
[~]# make
[~]# cp jsvc ../..
[~]# cd ../../..
5) Copy over any Host blocks from
/usr/local/jakarta/tomcat/conf/server.xml
from the old Tomcat install to the new Tomcat install (you may or may not be able to set up new hosts through WHM).
6) Copy over
/usr/local/jakarta/tomcat/conf/workers.properties
from the old Tomcat install to the new Tomcat install.
7) Restart the server
[/]# reboot
Or
[/]# /usr/local/jakarta/tomcat/bin/shutdown.sh
[/]# /usr/local/jakarta/tomcat/bin/startup.sh
[/]# /etc/init.d/httpd restart
9) Check Tomcat Version
[/]# sh /usr/local/jakarta/tomcat/bin/version.sh
The cPanel EasyApache system makes it easy to recompile Apache with various add-ons and modules.
If you ever need your old Tomcat back just stop Tomcat, flip the tomcat symbolic link back to the old install, and restart Tomcat.
Great post, the only thing I've run into with this is that tomcat won't start using the cpanel commands... I can get it to start by calling startup.sh directly, but the /usr/sbin/starttomcat which is what the /scripts/restartsvc_tomcat calls... it spits out a command for the jsvc that we compiled, but nothing happens... it doesn't actually run anything.
ReplyDeleteI managed to fix my own issue by hunting through the log files...
DeleteIn /usr/sbin/starttomcat you have to modify a line since it's still set up for the old tomcat 5.5
Locate: my $jars = "./bootstrap.jar";
Change to: my $jars = "./bootstrap.jar:./tomcat-juli.jar";
Tomcat 7 requires the additional tomcat-juli.jar to start up... once I added that, it starts up perfectly.
Thank you Admiral Chucky.
DeleteHelp!!
ReplyDeleteI have followed the steps but when I check the version is : Apache Tomcat/5.5.36
Help!!
ReplyDeleteI have followed the steps but when I check the version :
/usr/local/jakarta/tomcat/bin/version.sh
is : Apache Tomcat/5.5.36
when
/usr/local/jakarta/tomcat/apache-tomcat-7.0.32/bin/version.sh
is: Apache Tomcat/7.0.32
I think you omitted the third step.
DeleteAfter manipulating step 3, I use the command line: # ll / usr / local / jakarta
Deleteoutput screen:
drwxr-xr-x 4 tomcat nobody 4096 Dec 20 08:26. /
drwxr-xr-x 22 root root 4096 Dec 19 14:19 .. /
drwxr-xr-x 12 tomcat nobody 4096 Dec 20 08:26 apache-tomcat-5.5.36 /
drwxr-xr-x 9 tomcat nobody 4096 Dec 20 08:26 apache-tomcat-7.0.32 /
-rw-r - r - 1 root root 7701019 Oct 3 15:52 apache-tomcat-7.0.32.tar.gz
lrwxrwxrwx 1 tomcat nobody 39 Apr 4 17:04 tomcat -> / usr/local/jakarta/apache-tomcat-5.5.36 /
Not know that true?
Thanks!
ReplyDeleteI have done