Deploying Tomcat and Tomcat War package applications under Linux

Source: Internet
Author: User
Tags unpack xms

1, through WINSCP the Tomcat package (both 6 and 7 are the same installation method) and Jdk-6u27-linux-x64.bin installation files are transferred to the Linux system/opt inside. (There is no fixed to transfer to/OPT/HN, you can define it yourself.) )

2, install first unpack tomcat and install JDK (assuming Tomcat package is TOMCAT-6.0.35.TAR,JDK is jdk-7u17-linux-i586.tar.gz)

Unzip the tomcat command as follows:

[Email protected]lentim hn]# TAR-XVF Tomcat-6.0.35.tar

[Email protected] hn]# TAR-XZVF jdk-7u17-linux-i586.tar.gz

If the JDK exists as a bin file, you can unzip the installation directly using the command below.

[Email protected] hn]# sh jdk-6u27-linux-x64.bin

3, edit the startup.sh file in the */tomcat/bin directory, configure the JDK environment, add the following command with the following commands

[Email protected] ~]cd/opt/hn/tomcat-6.0.35/bin

[Email protected] bin]# VI startup.sh

Export JAVA_HOME=/OPT/HN/JDK1.7.0_17

Export catalina_home=/opt/hn/tomcat-6.0.35

Export tomcat_home=/opt/hn/tomcat-6.0.35

Export java_opts= "-xms512m-xmx512m"

Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $CATALINA _home/common/lib/servlet-api.jar

Export path= $PATH: $JAVA _home/bin: $CATALINA _home/bin: $TOMCAT _home/bin

4, how to start the Tomcat program and see the results of the startup

[Email protected] bin]# sh startup.sh|tail-f. /logs/catalina.out

Where SH startup.sh is running the tomcat command.

Tail display the last part of the file

-F If the size of the file is growing, tail will follow the file's growth and display

.. /Top level Directory

Logs/catalina.out the Catalina.out file inside the logs folder.

5, how to verify that we have successfully installed the Tomcat program, assuming that the server IP address of the deployment Tomcat is 192.168.0.51, then verify that the address is as follows:/http 192.168.0.51:8080

6, how to modify the port, (enter the Conf folder under the Tomcat directory, modify the Server.xml parameter)

[Email protected] conf]# pwd

/opt/tomcat-6.0.35/conf

[Email protected] conf]# VI server.xml

7,tomcat Basic Optimization

One, Java Virtual machine performance optimization

Because Tomcat relies on Java virtual machines to run. Select the corresponding JDK version according to the operating system of the host chosen by the customer. In the case of meeting the needs of the project, as far as possible to choose a higher version of the JVM, generally speaking, high-version products in speed and efficiency than the lower version will be improved. The performance of JDK1.4 is increased by 25%-75% compared to the JDK1.4 performance of the JDK1.3, which is nearly 10%-20%,jdk1.5. Therefore, it is recommended to use JDK1.6 for high performance requirements.

Second, memory optimization

Export java_opts= "-xms512m-xmx512m"

-xms<size> JVM Initializes heap size,-xmx<size> JVM heap Maximum, default value is 128M

It is recommended that you set the minimum heap size and the maximum heap size to the same value, as this avoids wasting the VM resources needed to adjust the heap size at all times.

Special: IBM virtual machines, to pay special attention to setting-XMS and-xmx the same size will delay the start of garbage collection until the heap is full, so that the first garbage collection will become very expensive operation. It is recommended that the-XMS be set to the minimum value required by the application, which results in efficient garbage collection.

8, how to publish the program on Tomcat:

One, now there is a Test.war package to deploy, put the Test.war package directly into the Tomcat_home/webapps directory, and then start Tomcat. The first boot Tomcat,tomcat will automatically unpack the Test.war. But this decompression is not connected to the database server, so we need to kill the first boot Tomcat process, the process of killing the operation guidelines are as follows:

[[Email protected] ~]# PS aux|grep java

[Email protected] ~]# kill-9 xxxx

Second, configure the database connection file, usually in the. xml file or, configure the data connection

Third, after configuring the database connection, start the Tomcat program again, we are ready to publish.

Deploying Tomcat and Tomcat War package applications under Linux

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.