Windows installation

Tomcat provides two Windows installation versions on its official website, a common installation version and a decompressed version. The regular installer comes with an installer, which you can follow through the setup screen just like you would with any Other Windows program until the installation is complete. Decompression version is equivalent to the green version, direct decompression can be used. Because the installer automatically registers for Windows services, the installer is more user-friendly for white users.

Zip package is decompressed can be used directly, equivalent to the green version. Installer comes with the Installer and can be installed as a Windows server.

Install the JDK

Download the appropriate JDK or JRE from the Oracle web site. JDK download

Start in normal mode

The startup of Tomcat is a bat script that can be started by double-clicking or executing in the command line window in the tomcat_path\bin directory.

If Tomca does not find the JAVA runtime environment, check whether the JAVA_HOME variable is set.

If the startup mode is command-line interface (CLI), a clear message is displayed.



After the startup is successful, you can see that a new window opens and a message is displayed.



Then you can access it through your browser and see the cat.

Configure Tomcat to start as a service

If Tomcat is installed using an installer, the Tomcat service will be automatically registered with the service. If Tomcat is installed using zip, you can also register the service by executing the following command.

cd tomcat_path\bin
service install tomcat
Copy the code

The name of the service can be defined by itself, and if you need to start multiple Tomcat services, you can distinguish them by name. Examples are as follows:

cd tomcat_7_path\bin
service install tomcat7
cd tomcat_8_path\bin
service install tomcat8
Copy the code

To register the service in this way, you need administrator user rights. During subsequent management, you can only start and stop the system as an administrator. If you want to start and stop the system as a common user, see the following section.

Start and stop the service as a common user

Use ordinary users to start and stop, also encountered a pit, stop the service can not stop, may be the service memory overflow. At this time want to kill the city have no authority, really want to cry no tears.

Linux installation

There are many installation methods under Linux, you can choose binary package, or you can use the source code package to compile and install. You can also install using the YUM source.

Directory Structure

directory role
bin Store some executable programs and related content to start and run Tomcat
conf Store the global configuration of the Tomcat server
lib Holds the JARS required to run Tomcat or the site, which are shared by all sites on this Tomcat
webapps The default site root directory, which can be changed
work Overresourced while the server is running, which simply means storing JSPS, servlet translations, and compiled results
logs Log directory
temp The temporary directory

Some major configuration parameters

Server.xml in the conf directory holds the main server Settings parameters.

Modifying the Default Port

Find the following section where you can change the external service port of the server

    <Connector port="8080" protocol="HTTP / 1.1"
               connectionTimeout="20000"
                redirectPort="8443" />
Copy the code

Modify the default site location

Tomcat has its own special requirements for the directory structure of website projects, unlike PHP, an interpreted language, which can organize directories at will. The folder that is the site must contain a web-INF subfolder. There must be a web.xml file in this subfolder.

References: 1. JDK 7 Download 2. Tomcat Download 3