CentOS 6.5 x64 Install TOMCAT8 and configure two x TOMCAT8

Source: Internet
Author: User

1. First, the premise of installing Tomcat is that the JDK environment variable has been configured, if not well can refer to my previous blog post: CentOS 6.5 x64 Installation Jdk8, of course, can also search through the network installation steps ~ ~

2. Download:

Can be downloaded through the official website: http://tomcat.apache.org/download-80.cgi, I downloaded this.

3. In Xftp, enter the/usr/local directory, create a new folder for Tomcat8, enter after two folders (because we want to install two Tomcat), respectively, tom8081 (for 8081 ports), tom8082 (for 8082 ports), Drag and drop our downloaded Tomcat into these two folders (for convenience) and use Xshell to enter/usr/local/tomcat8/tom8081 and enter the following command:

// extract to current directory tar -zxv-f apache-tomcat-8.5. 8. Tar

When you are done, go to/usr/local/tomcat8/tom8082 and execute the above command again. To save space, all two of us can remove the Tomcat compression package after the decompression is complete.

4. Configure the environment variable and enter the command:

//Open the System environment variable configuration fileVI/etc/ Profile//press the I key to enter edit State//enter the following command at the end# first Tomcat #CATALINA_BASE=/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8Catalina_home=/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8Tomcat_home=/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8Export catalina_base catalina_home tomcat_home# second TOMCAT #CATALINA_2_BASE=/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8Catalina_2_home=/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8Tomcat_2_home=/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8export catalina_2_base catalina_2_home tomcat_2_home

Finally, press the ESC key, then press shift+, and enter Wq save to exit.

After exiting, enter the following command to make the configuration effective immediately:

Source/etc/profile

It is important to note that our Java environment variables must be already configured. Otherwise, the following work cannot be done.

5. Configure two Tomcat

Enter the Conf directory of the tom8081:

cd/usr/local/tomcat8/tom8081/apache-tomcat-8.5. 8/conf

Modify the Server.xml file

//Open Server.xml FileVIServer.xml//press the I key to enter edit State//Find all 8080 fields replaced with 8081, following the replaced<connector port="8081"Protocol="http/1.1"ConnectionTimeout="20000"Redirectport="8443"/> <!--A"Connector"Using the shared thread pool--> <!--<connector executor="Tomcatthreadpool"Port="8081"Protocol="http/1.1"ConnectionTimeout="20000"Redirectport="8443"/>//Find the 8009 field replaced with 8010, below the one that has been replaced<!--Define an AJP1.3Connector on port8009-<connector port="8010"Protocol="ajp/1.3"redirectport="8443"/>//after the replacement is complete, press ESC, and then press shift+;, enter Wq save to exit

Enter the Conf directory of the tom8082:

cd/usr/local/tomcat8/tom8082/apache-tomcat-8.5. 8/conf

Modify the Server.xml file

//Open Server.xml FileVIServer.xml//press the I key to enter edit state
//Find Port 8005, modify to 9005<server port="9005"shutdown="SHUTDOWN">//Find all 8080 fields replaced with 8082, following the replaced<connector port="8082"Protocol="http/1.1"ConnectionTimeout="20000"Redirectport="8443"/> <!--A"Connector"Using the shared thread pool--> <!--<connector executor="Tomcatthreadpool"Port="8082"Protocol="http/1.1"ConnectionTimeout="20000"Redirectport="8443"/>//Find the 8009 field replaced with 8011, below the one that has been replaced<!--Define an AJP1.3Connector on port8009-<connector port="8011"Protocol="ajp/1.3"redirectport="8443"/>//after the replacement is complete, press ESC, and then press shift+;, enter Wq save to exit

6. Modify the Tomcat start stop path under tom8082

//go to Bin directorycd/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8/Li//editing catalina.sh files with VIVICatalina.SH//press the I key to enter edit State//at the beginning of the file, enter the following two lines of command#!/bin/SH    //The following are the two lines of command, this line is just a positional reference function//the name that follows is the name we use when we configure environment variablesExport catalina_base=$CATALINA _2_base Export Catalina_home=$CATALINA _2_home//Save and exit when you're done

7. After completing the above steps, start two Tomcat respectively

Go to the 8082 Bin directory and start Tomcat

//go to 8082 bin pathcd/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8/bin//Start Tomcat./startup.SH //output The following information to illustrate our 8082 startup success[Email protected] bin]#./startup.SHUsing catalina_base:/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8Using catalina_home:/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8Using Catalina_tmpdir:/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8/tempusing jre_home:/usr/local/java/jdk1.8. 0_111using CLASSPATH:/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8/bin/bootstrap.jar:/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8/bin/tomcat-Juli.jartomcat started.

Go to the 8081 Bin directory and start Tomcat

//go to 8081 bin pathcd/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8/bin//Start Tomcat./startup.SH //output The following information to illustrate our 8081 startup success[Email protected] bin]#./startup.SHUsing catalina_base:/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8Using catalina_home:/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8Using Catalina_tmpdir:/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8/tempusing jre_home:/usr/local/java/jdk1.8. 0_111using CLASSPATH:/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8/bin/bootstrap.jar:/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8/bin/tomcat-Juli.jartomcat started.

8. Add Tomcat to boot. If you do not want to join the boot boot, please skip to step 9.

Enter the following command

//editing rc.local files with VIVI/etc/rc.d/rc.local//Add the following three lines at the endExport JAVA_HOME=/USR/LOCAL/JAVA/JDK1.8. 0_111/usr/local/tomcat8/tom8081/apache-tomcat-8.5.8/bin/startup.SHStart/usr/local/tomcat8/tom8082/apache-tomcat-8.5.8/bin/startup.SHStart//Save//add rc.local as executable permissionchmod+x/etc/rc.d/rc.local

9. Reboot the system (must restart)

Reboot

All the steps have been completed. Now in the browser, we have access to our two tomcat.

^_^

CentOS 6.5 x64 Install TOMCAT8 and configure two x TOMCAT8

Related Article

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.