Linux systems deploy Web projects using Tomcat server

Source: Internet
Author: User
Tags apache tomcat

First, install the JDK

  1. Use FTP or other Linux transfer tools to remotely connect to Linux ports by default in SSH session

  2. Linux version jdk jdk-7u79-linux-i586.gz (available on the Oracle website to download. gz format for compressed packets, address http://www.oracle.com/technetwork/java/javase/ archive-139210.html) Compressed package uploaded to the/usr/local directory

  3. Use the SSH Remote Connection Script tool to connect to Linux and enter your user name and password. Then enter cd/usr/local carriage return,

    Enter the/usr/local directory and generate after extracting the JDK compression pack using TAR-ZXF jdk-7u79-linux-i586.gz

    jdk1.7.0_79 Directory

    This is used in the. gz format, or in. bin format files, which are uploaded to the/usr/local directory and entered in the local directory after using the JDK in this format./jdk-7u79-linux-i586.bin generates a folder after the This folder is the root directory of the JDK

  4. Configuring Environment variables

    4.1. Download the/etc/profile file locally and then open it with Notepad to append

    Export java_home=/usr/local/jdk1.7.0_79

    Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

    Export path= $JAVA _home/bin: $PATH

    Attention:

    1. Strictly case-sensitive

    2.linux using: As Path delimiter

    The 3.$ symbol indicates that the reference variable is followed by the variable name, and it is important not to overwrite the original value of the path variable, all the values that need to be appended with the path

    The role of 4.export is set to global variables


    You can also edit with the VI Edit command


4.2. Exit re-login at the command line input java-version if the following appears to indicate a successful configuration

Java Version "1.7.0_79"

Java (TM) SE Runtime Environment (build 1.7.0_79-b15)

Java HotSpot (TM) Client VM (build 24.79-b02, Mixed mode)


Ii. installation of Tomcat

1. The. gz format of the compressed package apache-tomcat-7.0.65.tar.gz (available to Apache Tomcat official website to download. gz format of the ZIP package, address http://tomcat.apache.org/) Upload to Linux/usr/local directory

2. SSH command tool into the/usr/local directory, using TAR-ZXF apache-tomcat-7.0.65.tar.gz to extract the generated apache-tomcat-7.0.65 file

3. Upload the published Web project for your local windows to the WebApps directory under apache-tomcat-7.0.65, or upload it to this directory with Eclipse as a war package

4. Note: The war packaging method skips this step

Modify the Server.xml file. Enter the Conf directory under apache-tomcat-7.0.65, upload the server.xml to the local, and then open the add the following configuration in the host element

<context docbase= "/usr/local/apache-tomcat-7.0.65/webapps/webtest" path= "/webtest"/>

and upload it to Linux to overwrite it.


You can also use the VI command to edit

5. Modify the firewall (do not modify firewall native cannot access the 8080 port of Linux)

5.1. Command Window input/sbin/iptables-i input-p tcp--dport 8080-j ACCEPT

5.2. Execute/etc/rc.d/init.d/iptables Save Settings

5.3. Perform/etc/rc.d/init.d/iptables restart restart service

5.4. View firewall status Execution/etc/init.d/iptables status

Third, start Tomcat

    1. Enter the bin directory under Tomcat to execute./startup.sh start Tomcat. /shutdown.sh stop Tomcat

    2. To enter the logs directory under Tomcat to perform tail-f catalina.out view Log If an error occurs last row of server startup in 1638 Ms indicates successful startup

    3. View Tomat process

    4. Execute command ps-ef|grep tomcat

      Sun 5144 1 0 10:21 pts/1 00:00:06/jav A/jdk/bin/java-djava.util.logging.manager=org.apache.juli.classloaderlogmanager-

      Djava.endorsed.dirs=/ Java/tomcat/common/endorsed-classpath:/java/tomcat/bin/bootstrap.jar:/java/tomcat/bin/commons-

      Logging-api.jar-dcatalina.base=/java/tomcat-dcatalina.home=/java/tomcat-djava.io.tmpdir=/java/tomcat/temp Org.apache.catalina.startup.Bootstrap start 

      5144 is the PID of the process

      4. View 8080 Port process

      Execute command netstat-anp| grep 8080 or netstat-nlp|grep 8080

      TCP        0      0::: 8080     &NBSP-------- ; :::*       LISTEN 5144/java

      5144 is 8080 Port-occupied process PID

Iv. Accessing Web Projects

Test the project directory structure

Wettest

Meta-inf

Web-inf

index.jsp


The contents of index.jsp are as follows:


<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "

pageencoding= "UTF-8"%>

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">

<title>insert title here</title>

<body>

<a href= "http://www.baidu.com" >www.baidu.com</a>

</body>

This machine opens the browser input http://192.168.121.11:8080/WetTest/index.jsp

192.168.121.11 for my linux virtual machine IP

If a www.baidu.com appears stating that access was successful


This article is from the "Love_programme-love_life" blog, make sure to keep this source http://codemcx.blog.51cto.com/9638142/1757369

Linux systems deploy Web projects using Tomcat server

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.