Install and configure Tomcat8.0 in Linux/CentOS7.0

Source: Internet
Author: User

Install and configure Tomcat8.0 in Linux/CentOS7.0

Install and configure Tomcat8.0 in Linux/CentOS7.0

1. Configure the Tomcat installation environment

1. Download the corresponding jdk

Http://www.Oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

I use 64-bit:

Http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-x64.tar.gz

Download and compress the jdk to the/usr/local directory:

2. Establish a jdk soft connection under/usr/local/to facilitate later version upgrades:

# Ln-s/usr/local/jdk1.8.0 _ 40 // usr/local/jdk

3. Environment Variables

Add the following content to/etc/profile:

JAVA_HOME =/usr/local/jdk1.8.0 _ 40

JAVA_BIN =/usr/local/jdk1.8.0 _ 40/bin

PATH = $ PATH: $ JAVA_BIN

CLASSPATH = $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar

Export JAVA_HOME JAVA_BIN PATH CLASSPATH

Save and exit

[Root @ master ~] Source/etc/profile

Check whether java environment variables take effect

[Root @ localhost local] # java-version

Java version "1.7.0 _ 51"

OpenJDK Runtime Environment (rhel-2.4.5.5.el7-x86_64 u51-b31)

OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

Note: When I configure the JAVA environment variable, JDK is jdk1.8.0 _ 40. When I run java-version, I get 1.7.0 _ 51.

This indicates that the JAVA environment variables in gcj in the system are given priority to execution. The solution is as follows:
Export PATH = $ JAVA_HOME/bin: $ PATH. Put $ PATH to the end. (If it is placed at the beginning, the above problem will occur)

# Java-version
Java version "1.8.0 _ 40"
Java (TM) SE Runtime Environment (build 1.8.0 _ 40-b25)
Java HotSpot (TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

You can uninstall it before installation:

[Root @ local src] # rpm-qa | grep java

Java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el6_5.x86_64

Rpm-e java-version-openjdk-devel depends on your version.

Ii. Tomcat8.0.20:

Http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.20/bin/apache-tomcat-8.0.20.tar.gz

# Tar xzf apache-tomcat-8.0.20.tar.gz // unzip

# Mv apache-tomcat-8.0.20/usr/local/tomcat

# Vim/usr/local/tomcat/bin/catalina. sh

Add: CATALINA_HOME =/usr/local/tomcat
Chmod + x *. sh

Iii. Start the tomcat server

1. Firewall allow 80

#/Etc/sysconfig/iptables // open it with VI

-A input-p tcp-m state-state NEW-m tcp-dport 80-j ACCEPT // Add this statement to allow 80

# Cd/usr/local/tomcat/bin/

#./Startup. sh // start tomcat

4. Enter test in the browser

Http: // localhost: 8080 (if it is not the local machine, enter the corresponding IP address)

If the tomcat page appears during the test, the test is successful!

5. Modify the port and add an application for testing

Ps: It should be noted that the default test page of tomcat is placed under webapps. This is actually configured in the server. xml file, as shown below:

<Host name = "192.168.1.8" appBase = "webapps"

UnpackWARs = "true" autoDeploy = "true">

</Host>

1) The webapps folder is mainly used for web Application Deployment. For example, you can copy your application package, such as a war file, to this directory, and the container will be automatically deployed.
2) In the conf folder, the configuration files of tomcat servers are mainly placed.

 

<Server port = "8005" shutdown = "SHUTDOWN"> // close the tomcat port.

<Connector port = "8080" protocol = "HTTP/1.1"

ConnectionTimeout = "20000"

RedirectPort = "8443"/> // default tomcat port 8080. Change to 80

<Connector port = "8009" protocol = "AJP/1.3" redirectPort = "8443"/> // port used to access tomcat in apache + tomcat Mode

 

For more Tomcat tutorials, see the following:

 

Install and configure the Tomcat environment in CentOS 6.6

 

Install JDK + Tomcat in RedHat Linux 5.5 and deploy Java Projects

 

Tomcat authoritative guide (second edition) (Chinese/English hd pdf + bookmarks)

 

Tomcat Security Configuration and Performance Optimization

 

How to Use Xshell to view Tomcat real-time logs with Chinese garbled characters in Linux

 

Install JDK and Tomcat in CentOS 64-bit and set the Tomcat Startup Procedure

 

Install Tomcat in CentOS 6.5

 

Tomcat details: click here
Tomcat: click here

 

This article permanently updates the link address:

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.