Tomcat Installation and optimization

Source: Internet
Author: User

Tomcat in JDK installation

[Email protected] ~]# cd/usr/local/src/

[[email protected]] #wget http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-i586.tar.gz? Authparam=1437564943_0e9e4215c41bb100c587fbae5f08d8cd

[[email protected]] #mv jdk-8u51-linux-i586.tar.gz\? AUTHPARAM\=1437564943_0E9E4215C41BB100C587FBAE5F08D8CD jdk-8u51-linux-i586.tar.gz

[Email protected] src]# tar zxvf jdk-8u51-linux-i586.tar.gz

[[email protected] src]# ls

Jdk1.8.0_51

[Email protected] src]# MV jdk1.8.0_51//usr/local/

[Email protected] src]# ls/usr/local/

Jdk1.8.0_51

[Email protected] src]# vim/etc/profile.d/java.sh

Java_home=/usr/local/jdk1.8.0_51

Java_bin=/usr/local/jdk1.8.0_51/bin

Jre_home=/usr/local/jdk1.8.0_51/jre

Path= $PATH:/usr/local/jdk1.8.0_51/bin:/usr/local/jdk1.8.0_51/jre/bin

classpath=/usr/local/jdk1.8.0_51/jre/lib:/usr/local/jdk1.8.0_51/lib:/usr/local/jdk1.8.0_51/jre/lib/ Charsets.jar

[email protected] src]# ls/usr/local/jdk1.8.0_51// Check to make sure that these paths exist

[Email protected] src]# Ls/usr/local/jdk1.8.0_51/bin

[Email protected] src]# LS/USR/LOCAL/JDK1.8.0_51/JRE

[Email protected] src]# source/etc/profile.d/java.sh

[email protected] src]# java-version// View Java version, which is a system self-installing,

Java Version "1.7.0_65"

Unloading

[email protected] src]# which Java

/usr/bin/java

[Email protected] src]# Rpm-qf/usr/bin/java

File/usr/bin/java is isn't owned by any package

[email protected] src]# Yum list |grep jdk

[email protected] src]# Yum remove java-1.7.0-openjdk* java-1.6.0-openjdk*

[Email protected] src]# java-version

-bash:/usr/bin/java:no such file or directory

// No version information available.

[Email protected] src]# source/etc/profile.d/java.sh

[Email protected] src]# java-version

java Version "1.8.0_51"// This version information appears, stating JDK the installation is successful

Tomcat installation

[[email protected]] #wget http://apache.fayea.com/tomcat/tomcat-7/v7.0.63/bin/apache-tomcat-7.0.63.tar.gz

[[email protected] src]# ls

Apache-tomcat-7.0.63.tar.gz

[Email protected] src]# tar zxvf apache-tomcat-7.0.63.tar.gz

[Email protected] src]# MV Apache-tomcat-7.0.63/usr/local/tomcat

[Email protected] src]# ls/usr/local/tomcat/

[Email protected] src]# cd/usr/local/tomcat/

[Email protected] tomcat]# cp-v Bin/catalina.sh/etc/init.d/tomcat

[Email protected] tomcat]# chmod 755/etc/init.d/tomcat

[Email protected] tomcat]# chkconfig--add Tomcat

Service Tomcat does not support chkconfig// Error not supported

[email protected] tomcat]# Vim/etc/init.d/tomcat// join from the second row

# chkconfig:2345 63 37

# Description:tomcat Server init script

# Source Function Library

. /etc/init.d/functions

Java_home=/usr/local/jdk1.8.0_51

Catalina_home=/usr/local/tomcat

[Email protected] tomcat]# chkconfig--add Tomcat

[[email protected] tomcat]# chkconfig Tomcat on

[[email protected] tomcat]#/etc/init.d/tomcat start

[[Email protected] tomcat]# PS aux |grep Tomcat

Root 2898 10.6 4.6 337584 48040 pts/0 Sl 04:19 0:03/usr/local/jdk1.8.0_51/bin/java-djava.util.logging.confi G.file=/usr/local/tomcat/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

[Email protected] tomcat]# NETSTAT-LNP

TCP 0 0:: ffff:127.0.0.1:8005:::* LISTEN 2898/java

TCP 0 0::: 8009:::* LISTEN 2898/java

TCP 0 0::: 8080:::* LISTEN 2898/java

[[email protected] tomcat]#/etc/init.d/tomcat stop// Reboot Required First Stop , then Start

[[email protected] tomcat]#/etc/init.d/tomcat start

[Email protected] tomcat]# IPTABLES-NVL

Windows Access 192.168.137.22:8080. the Tomcat default page appears

650) this.width=650, "style=" Border-bottom: #ddd 1px solid;border-left: #ddd 1px solid;background:url ("/e/u261/lang/ Zh-cn/images/localimage.png ") no-repeat center;border-top: #ddd 1px solid;border-right: #ddd 1px solid;" Src= "/e/u261/ Themes/default/images/spacer.gif "width=" 283 "height=" 182 "alt=" Spacer.gif "/>

Tomcat the optimization

[Email protected] tomcat]# cd/usr/local/tomcat/conf/

[[email protected] conf]# ls

[Email protected] conf]# vim Server.xml

will be <connector port= "8080" protocol= "http/1.1 " in the 8080 Change into the

// Insert:

Unpackwars= "false" autodeploy= "true" xmlvalidation= "false"

Xmlnamespaceaware= "false" >

<context path= "" docbase= "./" debug= "0" reloadable= "true" crosscontext= "true"/>

</Host>

[Email protected] conf]# mkdir-p/data/tomcatweb

[[email protected] conf]#/etc/init.d/tomcat stop

[[email protected] conf]#/etc/init.d/tomcat start

[[Email protected] conf]# PS aux |grep java

Root 3576 16.9 4.7 337456 48656 pts/0 Sl 04:36 0:03/usr/local/jdk1.8.0_51/bin/java-djava.util.logging.confi G.file=/usr/local/tomcat/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

[Email protected] conf]# NETSTAT-LNP

TCP 0 0::: +:::* LISTEN 3656/java

// The listening port becomes the

Client Access 192.168.137.22 no need to add 8080

650) this.width=650, "style=" Border-bottom: #ddd 1px solid;border-left: #ddd 1px solid;background:url ("/e/u261/lang/ Zh-cn/images/localimage.png ") no-repeat center;border-top: #ddd 1px solid;border-right: #ddd 1px solid;" Src= "/e/u261/ Themes/default/images/spacer.gif "width=" 321 "height=" 216 "alt=" Spacer.gif "/>

[Email protected] conf]# Touch/data/tomcatweb/1.txt

[Email protected] conf]# cd/data/tomcatweb/

[Email protected] tomcatweb]# vim 1.txt

11112

[Email protected] tomcatweb]# curl-xlocalhost:80 www.123.com/1.txt

11112

// Test What you can visit

[Email protected] tomcatweb]# vim/data/tomcatweb/1.jsp

Now time is: <%=new java.util.Date ()%>

</center></body>

[Email protected] tomcatweb]# curl-xlocalhost:80 www.123.com/1.jsp

Now time Is:thu Jul 04:47:29 CST 2015

</center></body>

// Normal parsing of its time

This article is from the Linux Learning Notes blog, so be sure to keep this source http://9656134.blog.51cto.com/9646134/1677228

Tomcat Installation and optimization

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.