本文主要是介绍分布式架构2--CentOs下安装Tomcat7(环境准备),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
声明:因为运行环境是基于Linux系统的,在做此框架之前需要做一些前期的环境准备工作
CentOs下安装Tomcat7网上很多实例,因为博客后期作为框架的原生教程,故这边做详细的安装记录,我这边已经下载好了Tomcat7,通过ssh已经上传到指定的目录,这里直接讲解安装的过程。
1. 安装tomcat
通过ssh将apache-tomcat-7.0.61.tar.gz文件上传到/usr/local中执行以下操作:
[root@cloud /]cd /usr/local
[root@cloud /]tar -zxvfapache-tomcat-7.0.61.tar.gz
[root@cloud /]mv apache-tomcat-7.0.61 tomcat
2. 启动Tomcat
[root@cloud ~]# /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: /home/Java/jdk1.7/
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
出现以上信息说明已成功启动。
3. 防火墙开放8080端口
[root@cloud /]vi + /etc/sysconfig/iptables
#增加以下代码
#Tomcat 8080
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
4. 重启防火墙
[root@cloud /]service iptables restart
5. 检验Tomcat安装运行,通过你自己的服务器IP查看tomcat是否运行正常:
http://xxx.xxx.xxx.xxx:8080/
看到tomcat系统界面,说明安装成功!
6. 停止Tomcat
[root@cloud ~]#/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: /home/java/jdk1.7
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
7. 查看启动、停止日志
[root@cloud ~]#cd /usr/local/tomcat/logs/
[root@cloud logs]# ls
catalina.2016-02-13.log catalina.out host-manager.2016-02-14.log localhost.2016-02-14.log localhost_access_log.2016-02-14.txt manager.2016-02-14.log
catalina.2016-02-14.log host-manager.2016-02-13.log localhost.2016-02-13.log localhost_access_log.2016-02-13.txt manager.2016-02-13.log
[root@cloud logs]# tail -f catalina.out
Feb 14, 2016 1:25:33 AMorg.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Feb 14, 2016 1:25:33 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Feb 14, 2016 1:25:33 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Feb 14, 2016 1:25:33 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Feb 14, 2016 1:25:33 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
源码地址获取:
http://minglisoft.cn/technology
请大家持续关注分布式架构3--CentOs下安装MySQL(环境准备)
这篇关于分布式架构2--CentOs下安装Tomcat7(环境准备)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!