Apache Tomcat 7 Installation and configuration

Source: Internet
Author: User
Tags apache tomcat

Download

first, you need to download the TOMCAT7 installation file, the address is as Follows:
Http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz

Installation and Configuration

Before installing, you need to ensure that you have installed the jdk, if you do not have the JDK installed, please refer to the previous blog to install Jdk:linux CentOS 7 & JDK 1.7 installation and configuration, if you have installed the jdk, then you can install tomcat, First upload the downloaded installation file to the appropriate directory of the Linux server, the first step is to Extract:

tar -zxvf apache-tomcat-7.0.57.tar.gz

Remove the installation package after the extract is Complete:

rm -rf apache-tomcat-7.0.57.tar.gz

Consider the latter to be a Tomcat cluster, so create a new directory and move the extracted tomcat in:

/wocloud/tomcat_cluster/mkdir /wocloud/tomcat_cluster/tomcat1mv ./apache-tomcat-7.0.57/ /wocloud/tomcat_cluster/tomcat1/

Let's first configure the Tomcat environment variables and memory settings, Enter the Tomcat bin directory and open the catalina.sh file with the VI command, and add the following configuration to It:

JAVA_OPTS="-Xms512m -Xmx1024m -Xss1024K -XX:PermSize=512m -XX:MaxPermSize=1024m"export TOMCAT_HOME=/wocloud/tomcat_cluster/tomcat1/apache-tomcat-7.0.57export CATALINA_HOME=/wocloud/tomcat_cluster/tomcat1/apache-tomcat-7.0.57export JRE_HOME=/wocloud/java/jdk1.7.0_75/jreexport JAVA_HOME=/wocloud/java/jdk1.7.0_75

As follows:

next, Modify the Tomcat port number, enter the Tomcat conf directory, Modify the Server.xml file, open the file via the VI command, directly enter/8080 to retrieve the location of the port number, after entering the edit mode, modify the port number to 8081, as shown in:

Last input : Wq Save Exit.

Next we can try to start Tomcat and switch to the Tomcat Bin directory to enter the start command:

./startup.sh

See the following tips to indicate that you have successfully started:

OK, next to the intranet through another Windows server to try to access the Check:

Unfortunately no access, but the port number does not have any problems, what is the cause of this? The reason is that Linux has a stronger security mechanism than windows, and a more powerful Firewall--firewall is introduced in CentOS 7. We need to open 8081 ports in the firewall, which means adding 8081 ports to the zone (firewall's new feature, which simply defines the trusted level of network connectivity). The command is as Follows:

firewall-cmd --zone=public --add-port=8081/tcp --permanent

This successfully joins the 8081 port into the public area, the permanent parameter indicates permanent, that is, the restart will not expire, and finally do not forget to update the firewall rules:

firewall-cmd --reload

OK, take a look at all the open ports under the public area, the command is as Follows:

firewall-cmd --zone=public --list-ports

You can see that port 8081 has been successfully opened:

Visit Tomcat again below to see the results:

good, successfully saw the familiar Tom cat, so far has successfully completed the Installation.

Summarize

Simply record the entire process of installing TOMCAT7 in Linux CentOS 7, hoping to help friends with the same problem, the End.

Apache Tomcat 7 Installation and configuration

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.