Basic configuration and installation of the installation free Tomcat server

  • 2020-05-09 19:42:36
  • OfStack

When I was on vacation, I occasionally installed 1 version. I have tried both the installation version and the free installation version, and I think the free installation version is better. There are many configuration involved and many files involved.

1. Configuration JDK

To install Tomcat on your own computer, you need JDK support, because Tomcat is a very lightweight Web server written in java.

Java SE download the latest version of address: / / www ofstack. com softs / 75615. html

1. After downloading the jdk you downloaded (1.7 is used here), unzip or install it. It is better to install jdk and jre in the same java directory, e.g. d:\Program Files\java\ jdk1.7.

2. Configure system variables

(1) right-click "my computer", select "properties" - "advanced", and click "environment variables".

(2) in order to easily change the jdk path and some other software, it is better to create a new JAVA_HOME environment variable, whose property value is "d:\Program Files\java\ jdk1.7", and add "%JAVA_HOME%\bin" to the path environment variable, preferably in front of it.

(3) finally, click the "new" button under the "user variable" box, "variable name" to fill in "classpath", and "variable value" to fill in "; % JAVA_HOME % \ lib \ tools jar; % JAVA_HOME % \ lib \ rt jar ". Once the configuration is complete, enter java and version in the command window to view the current version. A message appears indicating success.

2. Configuration Tomcat

1. Download the Tomcat.zip zip, I used the latest 7.0.27, and unzip it to d:\Program Files\tomcat7. Tomcat download address is: http: / / tomcat apache. org/download - 70. cgi, choose in the download page 32 - bit Windows zip or 64 - bit Windows zip options.

2. Setting of environment variables:

First, add the environment variable TOMCAT_HOME, with the value d:\Program Files\tomcat7. Then add CATALINA_HOME environment variable with the value of %TOMCAT_HOME%, and then add CATALINA_BASE environment variable with the value of %TOMCAT_HOME%. The installation-free version requires these two environment variables, which are written with the "%" sign for the convenience of later version changes. You can directly modify the value of TOMCAT_HOME, and change the value of CATALINA_HOME and CATALINA_BASE.

For the install-free version, the most important thing is to modify the startup.bat file in the conf folder in the root directory. If you do not modify the Tomcat file, you may not be able to start Tomcat.

Before line 1 (or after echo off) add the following two lines:

SET JAVA_HOME=JDK directory

SET CATALINA_HOME= directory of Tomcat after the previous unzip.

If you need to shut down the server using shutdown.bat, follow the above two lines.

3. Thus, running startup.bat will run the server, and running shutdown.bat will shut down the server.

3. Add Tomcat to the service

1. To download the version of zip from the Internet, you need to add service to tomcat, otherwise you cannot configure tomcat, which means you cannot open the Settings window opened by the program tomcatw.exe.

First run Win+R to open the run dialog box, enter the cmd command to open the console, enter the Tomat directory /bin folder with the cd command, and enter the following command:

service.bat   install

Program prompt: The service 'Tomcat7' has been installed similar statements.

Service Tomcat has been installed successfully. By the way, if you don't want tomcat, you can run service.bat remove can remove the service. That's unloading.

3, here, the service added successfully, and then input the run window services. msc command, open the window can see tomcat service has been added to the system, you can see add service, the service is run manually, by default in its properties, will change the startup type to "automatic" and after the machine starts Tomcat was launched in the background doesn't like (1 set).

  4. Startup mode of Tomcat

There are several ways to start the tomcat server.

Type 1: start the service (server) in the command console by entering the following statement in the command window to open or close the tomcat server:

net start service name

net stop service name

Type 2: open the tomcat server with the batch file startup.bat, and close the tomcat server with the batch file shutdown.bat.

Type 3: go to the bin directory under the Tomcat root directory, select a file like tomcat7w.exe, select the start button in the open window to open, or select the stop button to close the server.

The fourth way is similar to the first way. By opening the service window, select the service name of tomcat server, and right-click to select start or stop.

For the above four startup methods, the fundamental is to start the service.

These are just simple operations, through this operation you can easily configure the free installation of tomcat!


Related articles: