Tomcat installation and configuration batch processing script

Source: Internet
Author: User

Tomcat installation and configuration batch processing script

1. Install JDK 1.7

 

1. jdk1.7: Go to the official Download Page

 

2. Add environment variables: choose my computer> Properties> advanced> environment variables.

 

2. Create a system variable named java_home.
Variable value: C: \ Program Files \ Java \ jdk1.7.0 (JDK installation directory)

 

3. Add a semicolon to the original system variable path and add % java_home % \ bin; % java_home % \ Lib \ DT. jar; % java_home % \ JRE \ bin;
Do not delete the original one. Clearly, the semicolons between them are English semicolons.

 

4. restart the computer (because the system variable is added. If your system is win7/2008, you do not need to restart it ). For more information about setting Java environment variables, see the subsequent batch files.

 

4. test whether the JDK is successfully installed. Run-> cmd-> D:
Enter disk D and enter javac
If many commands are available, the JDK configuration is successful.

 

Ii. installation and configuration of Tomcat 7.0

 

1. Tomcat 7.0
(Go to the official website to download) the installation-free configuration (if you use Tomcat
Decompress the package to the C: \ Program Files directory. The directory structure is c: \ Program Files \ apache-Tomcat-7.0.11.

 

1. Add environment variables: choose my computer> Properties> advanced> environment variables.

 

2. Create a system variable named catalina_home.
Variable value: C: \ Program Files \ apache-Tomcat-7.0.11 (Tomcat
Directory ).

 

3. Add % catalina_home % \ Lib; % catalina_home % \ Lib \ servlet-api.jar at the end of the system variable path; % catalina_home % \ Lib \ jsp-api.jar
Note that the semicolon between them must be an English semicolon.

 

4, Tomcat 7.0 administrator configuration, enter c: \ Program Files \ apache-Tomcat-7.0.11 (Tomcat directory) under the conf directory, edit the tomcat-users.xml, find the last:

 

<! --

<Role rolename = "Tomcat"/>

<Role rolename = "role1"/>

<User Username = "Tomcat" Password = "Tomcat" roles = "Tomcat"/>

<User Username = "both" Password = "Tomcat" roles = "tomcat, role1"/>

<User Username = "role1" Password = "Tomcat" roles = "role1"/>

-->

 

Add the following content after the preceding section:

 

<Role rolename = "Manager-Gui"/>

<Role rolename = "Admin-Gui"/>

<User Username = "admin" Password = "Tomcat" roles = "Admin-Gui"/>

<User Username = "Tomcat" Password = "Tomcat" roles = "Manager-Gui"/>

 

Red indicates the add part. Here, we should know the username and password of the Administrator we have added!

 

5. Go to Tomcat
In the bin directory, double-click STARTUP. bat
When Tomcat is started, an English prompt is displayed in the command line window.

 

6. Enter http: // localhost: 8080 in the browser.
The Tomcat welcome page shows that the configuration is successful. Click Manager connection in the upper-right corner and enter the user name and password configured above to go to the Management page.

 

 

3. Configure the Java environment variable for batch processing:

@ Reg Add "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ environment"/V classpath/T reg_expand_sz/D ".; % java_home % \ Lib \ DT. jar; % java_home % \ Lib \ tools. jar; % java_home % \ Lib \ htmlconverter. jar"
/F

@ Reg Add "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ environment"/V path/T reg_expand_sz/D ".; % PATH %; % java_home % \ bin "/F

@ Reg Add "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ environment"/V java_home/T REG_SZ/D "% Cd %"/F

There are two notes:

First, % in the batch must use the Escape Character % to maintain the variable symbol.

The second is that the variables must be finally poured into java_home, so that the variables will not be automatically converted only when % java_home % is called.

Usage: Save the above Code as JDK. BAT and place it in the JDK installation directory !!! Double-click to complete environment variable configuration.

 

4. Configure Tomcat environment variable Batch Processing

 

@ Reg Add "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ environment"/V path/T reg_expand_sz/D ".; % PATH %; % catalina_home % \ Lib \ servlet-api.jar; % catalina_home % \ Lib \ jsp-api.jar "/F

@ Reg Add "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ environment"/V catalina_home/T REG_SZ/D "% Cd %"/F

 

Usage: Save the above Code as Tom. BAT and place it in the tomcat installation directory !!! Double-click to complete environment variable configuration.

Note: It is best to restart the machine after the environment variable is modified. Therefore, when JDK is run. after the BAT file, restart the machine. Otherwise, run Tom again. during bat, the environment variable path will be overwritten.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.