[ Team LiB ] Previous Section Next Section

Installing Tomcat on Windows

To install Tomcat on Windows, simply download the jakarta-tomcat.exe file from the Binaries section of the Jakarta Web site. The filename usually has the version number embedded within it as well. The .exe file unpacks and installs Tomcat. It can even set up entries in your Windows Start menu for starting and stopping Tomcat.

When you run the installation program, it first searches for an installed Java Development Kit. If you don't already have a JDK installed, download one from http://java.sun.com and install it before installing Tomcat. After the Tomcat installer finds a JDK, it presents a license agreement.

After agreeing to the license, you can choose what parts of Tomcat you want to install. If you are running Windows NT, 2000, or XP, you may install Tomcat as an NT service. Figure A.1 shows the component selection screen.

Figure A.1. Select which components you wish to install.

graphics/ap01fig01.jpg

After the installation program completes, Tomcat is installed on your system.

Testing the Installation

To start Tomcat, simply select the Start Tomcat menu option from your Windows Start menu.

By default, Tomcat starts on port 8080. Point your browser to http://localhost:8080 and you should see a screen like the one shown in Figure A.2. If you installed Tomcat on a machine other than the one where your browser is, use the hostname of the machine where Tomcat is running instead of localhost.

Figure A.2. This is the default Tomcat home page.

graphics/ap01fig02.jpg

Installing Tomcat on Linux or Unix

To install Tomcat on Linux or Unix, go to the directory where you want to install Tomcat. You don't need to be root to install Tomcat, unless you are installing it in a protected directory such as /usr/local. No matter which file you downloaded—the .zip, .tar.Z, or .tar.gz—Tomcat will be installed in a subdirectory called jakarta-tomcat from wherever you unpack it. If you want to install it in /usr/local/jakarta-tomcat, you must unpack it from the /usr/local directory.

Remember to change /home/mark/download to the path where you downloaded Tomcat.

If you downloaded jakarta-tomcat.tar.gz, you can unpack it this way:


gunzip –c /home/mark/download/jakarta-tomcat.tar.gz | tar xvf –

Make sure you have gunzip on your machine. If you are running Linux or have the GNU version of tar, you can unpack the file like this:


tar xvzf /home/mark/download/jakarta-tomcat.tar.gz

If you downloaded jakarta-tomcat.zip, unpack it with this command:


unzip /home/mark/download/jakarta-tomcat.zip

After you unpack Tomcat, you are ready to try it out. Go to the bin directory under the jakarta-tomcat directory and type ./startup.sh.

Although it isn't required to run Tomcat, you should set the TOMCAT_HOME environment variable to point to the directory where you installed Tomcat. Some of the other Tomcat tools make use of TOMCAT_HOME.

As with the Windows version, Tomcat starts on port 8080 by default. Point your browser to http://localhost:8080 and you should see a screen like the one shown previously in Figure A.2. If you installed Tomcat on a machine other than the one where your browser is, use the hostname of the machine where Tomcat is running instead of localhost.

    [ Team LiB ] Previous Section Next Section