码迷,mamicode.com
首页 > 编程语言 > 详细

JAVA企业应用【第二篇】TOMCAT安装

时间:2016-10-26 19:51:08      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:dtd   source   lease   notice   tail   png   tun   isp   lis   

1、软件准备:

JDK下载:http://www.oracle.com
Tomcat下载:http://tomcat.apache.org/

2、部署java环境:

技术分享
mkdir -p /application/tools/ && cd /application/tools/

tar xf jdk-8u60-linux-x64.tar.gz -C /application/

ln -s /application/jdk1.8.0_60 /application/jdk

sed -i.ori $a export JAVA_HOME=/application/jdk\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar /etc/profile

source /etc/profile
View Code
[root@tomcat ~]# java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

3、安装tomcat:

技术分享
tar xf apache-tomcat-8.0.27.tar.gz -C /application/

ln -s /application/apache-tomcat-8.0.27 /application/tomcat

echo export TOMCAT_HOME=/application/tomcat>>/etc/profile

source /etc/profile

chown -R root.root /application/jdk/ /application/tomcat/
View Code
[root@tomcat ~]# tail -4 /etc/profile
export JAVA_HOME=/application/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
export TOMCAT_HOME=/application/tomcat

4、tomcat目录:

[root@tomcat ~]# cd /application/tomcat/
[root@tomcat tomcat]# tree -L 1
.
├── bin         #→用以启动、关闭Tomcat或者其它功能的脚本(.bat文件和.sh文件)
├── conf        #→用以配置Tomcat的XML及DTD文件
├── lib         #→存放web应用能访问的JAR包
├── LICENSE
├── logs        #→Catalina和其它Web应用程序的日志文件
├── NOTICE
├── RELEASE-NOTES
├── RUNNING.txt
├── temp        #→临时文件
├── webapps     #→Web应用程序根目录
└── work        #→用以产生有JSP编译出的Servlet的.java和.class文件
7 directories, 4 files
[root@tomcat tomcat]# cd webapps/
[root@tomcat webapps]# ll
total 20
drwxr-xr-x 14 root root 4096 Oct  5 12:09 docs     #→tomcat帮助文档
drwxr-xr-x  6 root root 4096 Oct  5 12:09 examples #→web应用实例
drwxr-xr-x  5 root root 4096 Oct  5 12:09 host-manager #→管理
drwxr-xr-x  5 root root 4096 Oct  5 12:09 manager  #→管理
drwxr-xr-x  3 root root 4096 Oct  5 12:09 ROOT     #→默认网站根目录

5、启动tomcat:

#→启动程序/application/tomcat/bin/startup.sh
#→关闭程序/application/tomcat/bin/shutdown.sh

[root@tomcat ~]# /application/tomcat/bin/startup.sh
Using CATALINA_BASE: /application/tomcat
Using CATALINA_HOME: /application/tomcat
Using CATALINA_TMPDIR: /application/tomcat/temp
Using JRE_HOME: /application/jdk
Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar
Tomcat started.

[root@tomcat ~]# netstat -tunlp|grep java
tcp 0 0 :::8009 :::* LISTEN 4743/java 
tcp 0 0 :::8080 :::* LISTEN 4743/java

[root@tomcat ~]# ps -ef|grep [j]ava

6、访问网站:

网址:http://1.1.1.1/8080

技术分享

7、tomcat日志:

[root@tomcat tools]# cd /application/tomcat/logs/
[root@tomcat logs]# ls
catalina.2016-10-26.log host-manager.2016-10-26.log localhost_access_log.2016-10-26.txt
catalina.out localhost.2016-10-26.log manager.2016-10-26.log

#→tomcat实时日志

技术分享
[root@tomcat logs]# tailf catalina.out 
26-Oct-2016 15:53:23.782 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /application/apache-tomcat-8.0.27/webapps/docs has finished in 60 ms
26-Oct-2016 15:53:23.786 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /application/apache-tomcat-8.0.27/webapps/host-manager
26-Oct-2016 15:53:23.888 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /application/apache-tomcat-8.0.27/webapps/host-manager has finished in 102 ms
26-Oct-2016 15:53:23.889 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /application/apache-tomcat-8.0.27/webapps/examples
26-Oct-2016 15:53:24.673 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /application/apache-tomcat-8.0.27/webapps/examples has finished in 784 ms
26-Oct-2016 15:53:24.674 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /application/apache-tomcat-8.0.27/webapps/manager
26-Oct-2016 15:53:24.772 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /application/apache-tomcat-8.0.27/webapps/manager has finished in 98 ms
26-Oct-2016 15:53:24.779 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
26-Oct-2016 15:53:24.795 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
26-Oct-2016 15:53:24.800 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1994 ms
View Code

 

JAVA企业应用【第二篇】TOMCAT安装

标签:dtd   source   lease   notice   tail   png   tun   isp   lis   

原文地址:http://www.cnblogs.com/luchuangao/p/6001324.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!