Linux install Java and tomcat

Source: Internet
Author: User



Download JDK tar package and Tomcat tar package on official website

[Email protected] ~]# Mkdir/usr/local/java
[Email protected] ~]# TAR-ZXVF jdk-8u25-linux-x64.tar.gz
[Email protected] ~]# MV jdk1.8.0_25/*/usr/local/java/
Setting Java Environment variables
[Email protected] ~]# CP/ETC/PROFILE/ETC/PROFILE.BK
[Email protected] ~]# Vi/etc/profile
Export Java_home=/usr/local/java
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH
"/etc/profile" 82L, 1949C written
[Email protected] ~]# Source/etc/profile
Test if Java is successful
[Email protected] ~]# java-version
Java Version "1.8.0_25"
Java (TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot (TM) 64-bit Server VM (build 25.25-b02, Mixed mode)
[Email protected] ~]# TAR-ZXVF apache-tomcat-8.0.15.tar.gz
Installing Tomcat
[Email protected] ~]# Mkdir/usr/local/tomcat
[Email protected] ~]# MV apache-tomcat-8.0.15
Apache-tomcat-8.0.15/apache-tomcat-8.0.15.tar.gz
[Email protected] ~]# MV apache-tomcat-8.0.15/*/usr/local/tomcat/
Set the Tomcat environment path variable, and the catalina.sh file is added last
[Email protected] ~]# vi/usr/local/tomcat/bin/catalina.sh

catalina_home=/usr/local/tomcat/
"/usr/local/tomcat/bin/catalina.sh" 581L, 21395C written
Set script permissions
[Email protected] ~]# chmod +x/usr/local/tomcat/bin/*.sh
[Email protected] ~]#/usr/local/tomcat/bin/startup.sh
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using Jre_home:/usr/local/java/jre
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
Set up a firewall
[[email protected] ~]# iptables-i input-p TCP--dport 8080-j ACCEPT
[[Email protected] ~]# service Iptables Save
iptables:saving firewall rules to/etc/sysconfig/iptables: [OK]
[Email protected] ~]# service iptables restart
iptables:flushing firewall rules: [OK]
Iptables:setting chains to Policy Accept:filter [OK]
iptables:unloading modules: [OK]
iptables:applying firewall rules: [OK]
Open service
[Email protected] ~]# Ps-ef | grep java
Root 2743 1 01:30 pts/1 00:00:11/usr/local/java/jre/bin/java-djava.util.logging.config.file=/usr/local/to Mcat/conf/logging.properties-djava.util.logging.manager=org.apache.juli.classloaderlogmanager- djava.endorsed.dirs=/usr/local/tomcat/endorsed-classpath/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/ bin/tomcat-juli.jar-dcatalina.base=/usr/local/tomcat-dcatalina.home=/usr/local/tomcat-djava.io.tmpdir=/usr/ Local/tomcat/temp org.apache.catalina.startup.Bootstrap Start
Root 2872 2636 1 01:31 pts/1 00:00:00 grep java
[Email protected] ~]# Netstat-ano | grep 8080
TCP 0 0::: 8080:::* LISTEN off (0.00/0/0)
TCP 0 0:: ffff:192.168.98.194:8080:: ffff:192.168.98.173:64260 time_wait timewait (54.27/0/0)
TCP 0 0:: ffff:192.168.98.194:8080:: ffff:192.168.98.173:64261 time_wait timewait (54.27/0/0)
[Email protected] ~]#/usr/local/tomcat/bin/shutdown.sh
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using Jre_home:/usr/local/java/jre
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[Email protected] ~]#/usr/local/tomcat/bin/startup.sh
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using Jre_home:/usr/local/java/jre
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[Email protected] ~]#

This article is from the "Zoo" blog, make sure to keep this source http://zuopiezi.blog.51cto.com/4831427/1595610

Linux install Java and tomcat

Related Article

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.