0

How do I deploy a Java War archive/web application into a server that uses the latest version of Cpanel control panel? The server has Cent OS 6.2 OS.

Arvind
  • 501
  • 4
  • 9
  • 18

1 Answers1

1

Update: i might have misunderstood your request, if you don't have any Java Application server, then you can install tomcat using the following commands as root at an ssh/telnet console;

# install tomcat6 and httpd
yum -y install tomcat6 java-1.6.0-openjdk httpd mysql-connector-java

that command will install a lot of dependencies, but importantly it sets up tomcat and httpd as services, which can be started like so;

service httpd start
service tomcat6 start

and to add to be started automatically every reboot;

chkconfig tomcat6 on
chkconfig httpd on

You can setup SSH from cpanel folowing these instructions; - http://docs.cpanel.net/twiki/bin/view/11_30/CpanelDocs/ShellAccess

or this tutorial; - http://www.cpanel.net/media/tutorials/ssh.htm

So assuming that either you have tomcat or that the Java application server supports some form of auto-deployment, then you should copy the war file to the appropriate directory;

1) tomcat auto-deploy folder under CentOS is

/var/lib/tomcat6/webapps

2) glassfish supports auto-deployment under the auto-deploy folder under domain1;

/opt/glassfishv3/glassfish/domains/domain1/autodeploy

You should be able to copy the file from your local machine to these folders using the cpanel File Manager.

If you do not have a war file, then the alternative is to create context fragment into the /usr/share/tomcat6/conf/Catalina/localhost/ folder like this post describes;
http://wiki.metawerx.net/wiki/Context.xml

Both glassfish and tomcat also support their own manager interfaces via the various admin tools (which you almost certainly want to configure eventually, in order to effectively manage these apps) which you can alternatively use to deploy WAR archives remotely.

However be aware that securing tomcat manager is important, as its easy to leave open with silly easy password etc.

Tom
  • 11,176
  • 5
  • 41
  • 63
  • I have Tomcat already installed using EasyApache in cpanel- are your instructions applicable still in my case? Thanks... – Arvind Apr 26 '12 at 05:29
  • from what I understood, EasyApache installs Apache web server and PHP, but not apache tomcat. You might need to run the above commands to find out. If you can get a shell login try `rpm -qa | grep tomcat6` – Tom Apr 26 '12 at 07:36
  • ok, i did install tomcat using whm, and now i can see under "Restart Services" in WHM, an option for "Restart Tomcat Servlet Server"... so tomcat is installed... – Arvind Apr 26 '12 at 09:36
  • right, so using the cpanel File manager, look for the folder `/var/lib/tomcat6/webapps` and then copy your war file into that. – Tom Apr 26 '12 at 09:42