How to Install Apache Tomcat
Apache Tomcat is an open source implementation of two Java technologies which will be covered in later tutorials: Java servlets and Java Server Pages (JSP). Apache Tomcat provides a server runtime environment to support Java servlets and JSPs.
We will use Apache Tomcat version 7, which supports Servlet 3.0, JSP 2.2 and Java 1.6. If you haven’t already done so, install the Java Development Kit (JDK), Eclipse and the Web Tools Platform before continuing on here.
- How to Install the Java Development Kit
- How to Install Eclipse
- How to Install the Web Tools Platform
Install Apache Tomcat
Locate the Core Binary Distribution appropriate for your operating system. Windows users may select “32-bit/64-bit Windows Service Installer.” The installer is the best option for newcomers since it guides the user through the installation and configuration process.
Using the Windows Installer
After downloading and running the Windows Service Installer, choose the “Full” install type and click Next. You will see the following configuration box containing default values:
These options are fine. Choose Next, then accept the default values for the Java Runtime path and Tomcat destination folder. Finally choose Install.
When all is done, you should be able to view the default Tomcat webpage located at http://localhost:8080
Configuring Manager Application Access
The Manager Application allows us to administer Tomcat, but it is disabled by default. The Manager Application allows us to upload and manage our Java applications, and also provides some diagnostics.
You grant access by creating a user having the manager-gui role. To do this, you must edit the following file:
C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\tomcat-users.xml
Right click this file, choose Edit, then add a line at the bottom of the file so that the last two lines of the file look something like this:
<user username="admin" password="secret" roles="manager-gui" /> </tomcat-users>
The key thing to change is the word secret; change it to something only you know.
Note for Windows 7 Users: Save the file on the Desktop, then move it back into the conf directory, overwriting the original file. Windows 7 does not make it easy to edit files anywhere in the Program Files folder.
Next, stop then start the Tomcat service to activate this change and grant access to the Manager Application. You should see the Tomcat service icon on the Windows taskbar next to the clock. Right click it to see the options to stop, then start, the Tomcat service.
Finally, access the Manager Application here: http://localhost:8080/manager/html
References
Apache Tomcat 7. Manager App HOW-TO. Retrieved September 12, 2011, from http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
Apache Tomcat Versions. Apache Tomcat. Retrieved September 7, 2011, from http://tomcat.apache.org/whichversion.html
