Linux – How to deploy a WAR file on Linux machine

apachelinux

I have a Linux Machine. Apache server is running and I need to deploy my project which is a .war file developed on Windows machine.

Can someone give me bit idea how to do that?

Best Solution

if you have FTP or SCP access to the directories where Tomcat is installed, you should be able to simply copy the generated WAR file to the tomcat/webapps directory. Tomcat will automatically deploy the war for you.

When redeploying, I find it safest to delete the original .WAR file in Tomcat, and tomcat will automatically destory the exploded directory for you. When that's done, copy up the .WAR file.

Finally, make sure you copy the .WAR file "all at once". If you have a slow upload, Tomcat will try and deploy the .WAR file even though it has not completely been uploaded yet. This will lead to a partial or unsuccessful deployment. It's best if you upload to a neutral directory (home directory, temp, whichever), and then either rename (using mv) the .WAR into tomcat, or simply copy it there using the local file systems copy command. Much faster than the upload. Safest way is to mv the file from the same filesystem.

All of this assumes you do not have any of the manager or admin ports open for Tomcat, as it provides mechanisms to remotely deploy applications directly.

But, in truth, simply removing the old app and slipping in the new app works simply and well for many applications.