Centos7.2 JDK installation + Tomcat installation + firewall configuration

Source: Internet
Author: User
Tags iptables

Preface
The server environment was often deployed before, but the whole process was not properly sorted, and now it is finally sorted out, hoping to provide a reference for friends who are in need of a web environment, and then leave a record for themselves.

I. Environment and software preparation
Before you build a Web project, you need to deploy the environment that you need.
1, the system selected is the Centos7.2 64-bit
2, the JDK version is jdk-7u71-linux-x64.tar.gz
3, tomcat version is nginx-1.7.6.tar.gz
4, Firewall is iptables

Second, the installation of JDK
1, the JDK decompression, and then modify the directory name

TAR-ZVXF jdk-7u71-linux-x64.tar.gz

After the decompression, modify the directory

MV Jdk1.7.0_71 jdk1.7

2. Configure Environment variables

Vi/etc/profile

Add the following to the back of the file

Export java_home=/data/jdk1.7
Classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin

Save the file and exit, and then execute

Source/etc/profile

Whether the test was successful

Java-version

Third, the installation of Tomcat
1, decompression tomcat, and then modify the directory

TAR-ZVXF apache-tomcat-7.0.55.tar.gz

After the decompression, modify the directory

MV apache-tomcat-7.0.55 TOMCAT7

2. Configure Environment variables

Vi/etc/profile

Add the following:

Export TOMCAT_HOME=/DATA/TOMCAT7

Save and exit, and then execute

Source/etc/profile

3. Start Tomcat

Cd/data/tomcat7
./startup.sh

Iv. Configuration of Firewalls
1. Close Firewall

    Service Firewalld Stop
power-on Disable Startup
    Systemctl Disable Firewalld.service

2, install iptables, open 80, 8080 ports

    Yum Install Iptables-services

Modify configuration file Iptables

     Vi/etc/sysconfig/iptables

Add the following content

-A input-p tcp-m State--state new-m TCP--dport 80-j ACCEPT
-A input-p tcp-m State--state new-m TCP--dport 8 080-j ACCEPT

Save exit, open Iptables Service

Service  iptables Start

Set startup on

   Systemctl Enable Iptables.service

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.