11.04
Plan for Change.
Note: This article is based on Apache Tomcat 6.0.20
If you set up a lot of Tomcat sandboxes, here is a sample structure to make it easy to upgrade to a new version of Tomcat without having to reinstall all applications. The trick is to have a number of Tomcat sandboxes pointing to a symbolic link, which in turn points to the latest version of Tomcat.
Download Tomcat
Get latest version of Tomcat from Apache. Check signature. Decompress. Untar.
> cd ... > tar -xvf apache-tomcat-6.X.X.tar
Now create a symbolic link to this latest version
> ln -s apache-tomcat-6.X.X apache-tomcat-latest
Create a sandbox
A sandbox refers to a directory where you are testing a web application. Portions of the sandbox are linked back to the latest version of Tomcat. Other portions of the sandbox are original to it.
> mkdir tomcat.sandbox > cd tomcat.sandbox > ln -s ../apache-tomcat-latest/bin . > ln -s ../apache-tomcat-latest/lib . > ln -s ../apache-tomcat-latest/conf . > mkdir work > mkdir logs > mkdir webapps
To add a WAR file to Tomcat, simply copy it to the tomcat.sandbox/webapps directory. It will be auto detected when Tomcat starts and deployed.
Finally, start Tomcat.
> cd bin > ./catalina.sh run
Obviously, there is more to configuring and running Tomcat. You can get more information by starting at the Tomcat Homepage.
Upgrading
When a new version of Tomcat becomes available, repeat the first step. Download, verify, decompress and untar the latest version, alongside the first version. Then, change the symbolic link of latest Tomcat to the new one.
> cd ... > tar -xvf apache-tomcat-6.Y.Y.tar > rm apache-tomcat-latest > ln -s apache-tomcat-6.Y.Y apache-tomcat-latest
Now, all sandboxes are pointing at the latest libraries. Restart all sandboxes.
Unless major changes have occurred in configuration files, this trick should let you upgrade painlessly.
No Comment.
Add Your Comment