Java environment--JDK and Tomcat installation and configuration on Linux

Source: Internet
Author: User

Installation and configuration of Tomcat on Linux

The following Linux versions are used: The Redhat Enterprise Linux 7.0 x86_64,tomcat version is tomcat-7.0.54.
1. Download the JDK and Tomcat.
Jdk:
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Tomcat:
http://tomcat.apache.org/download-70.cgi


2.JDK installation and configuration.
(1) JDK installation
RPM Package:
# RPM-IVH jdk-7u55-linux-x64.rpm

TAR.GZ Package: Unzip
# Mkdir/usr/java
# Cd/usr/java
# tar-zxvf/software/jdk-7u55-linux-x64.tar.gz
Generate links for version upgrades
# ln-s Jdk1.7.0_55 Latest
# ln-s Latest Default

(2) Configuring environment variables
# Vi/etc/profile
Export Java_home=/usr/java/default
Export java_bin= $JAVA _home/bin
Export path= $PATH: $JAVA _home/bin
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH

Make configuration effective
# Source/etc/profile

Test the JDK.
# java-version
Java Version "1.7.0_55"
Java (TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot (TM) 64-bit Server VM (build 24.55-b03, Mixed mode)

This completes the installation of the JDK, following the installation of Tomcat:

Installation of 3.Tomcat
Unzip
# Mkdir/usr/local/tomcat
# Cd/usr/local/tomcat
# tar-zxvf/software/apache-tomcat-7.0.54.tar.gz
Generate links for version upgrades
# ln-s apache-tomcat-7.0.54 Server

Start Tomcat
# Cd/usr/local/tomcat/server/bin
#./startup.sh
Using catalina_base:/usr/local/tomcat/server
Using Catalina_home:/usr/local/tomcat/server
Using Catalina_temdir:/usr/local/tomcat/server/temp
Using Jre_home:/usr/java/default
Using Class_path:/usr/local/tomcat/server/bin/bootstrap.jar:/usr/local/tomcat/server/bin/tomcat-juli.jar
Tomcat started.

Test Tomcat:
Open the firewall to allow external access
#/sbin/iptables-i input-p TCP--dport 8080-j ACCEPT
# Service Iptables Save
# Service Iptables Restart
or directly modify the file/etc/sysconfig/iptables.
# Vi/etc/sysconfig/iptables
-A input-p tcp-m tcp--dport 8080-j ACCEPT
# Service Iptables Restart
In the browser input: http://192.168.16.133:8080
As can be entered in this machine: http://localhost:8080
The page that appears Tomcat indicates that the installation was successful.
Note: Notice how the firewall acts on the tomcat port to prevent it from being masked out

Stop Tomcat
#./shutdown.sh

4. Configure the Web Access port (modify the Tomcat port number)
You can modify the file Server.xml in the Conf directory, modify the connector element (the default port for Tomcat is 8080) and need to restart the Tomcat service to take effect.
# Vi/usr/local/tomcat/server/conf/server.xml
<connector port= "protocol=" http/1.1 "connectiontimeout=" 20000 "redirectport=" 8443 "/>

Configuration of Tomat virtual host under 5.linux

6.TOMCAT Configuration of virtual directories

Deploy multiple Tomcat on 7.linux

Java environment--JDK and Tomcat installation and configuration on 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.