In this section you will download and install Apache Tomcat 5.5.16. For this particular setup, there is no need to build the package from source, we will download the binary version.
1. Download the binary version to your preferred download directory from here: http://tomcat.apache.org/download-55.cgi. Choose the tar.gz from the core section for 5.5.16.
2. Now change to that directory and extract the files using the following command:
#cd /downloads #(be sure to change to your download directory)
You should now have a new directory called apache-tomcat-5.5.16. Now move this directory to the location where it should be installed. Again, We chose /usr/lib/. Note that this location will be referred to as CATALINA_HOME in the Tomcat documentation.
#mv apache-tomcat-5.5.16 /usr/lib
3. Next change to the /usr/lib/ directory.
4. Now create a symbolic link called apache-tomcat to the CATALINA_HOME by the following command.
#ln -s apache-tomcat-5.5.16 apache-tomcat
This will save you from having to make changes to startup and shutdown scripts each time you upgrade Tomcat and if you so desire, it also allows you to keep several versions of Tomcat on your system and easily switch amongst them.
You should now be able to start and stop Tomcat from the CATALINA_HOME/bin directory. If you are using another shell other than the bash shell you will need to add sh to the beginning of the command. You should now be able to test that Tomcat is installed by starting it and opening your browser and entering http://localhost:8080 into your browser.
Port 8080 is the default port for Tomcat and can be easily changed in the /usr/lib/apache-tomcat/conf/server.xml file. (We will work with this file later on.) If you plan to access this page remotely, be sure to forward the respective port to your server’s IP address within your router. You should now see the Tomcat welcome page that contains links to Tomcat documentation as well as sample JSP/Servlet scripts. Verify that Tomcat is running by executing some of the examples found on the welcome page.
To shutdown the server, you will need to execute the following command. Feel free to try it, but for now we will leave Tomcat running.