分布式架构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
成都创新互联公司-专业网站定制、快速模板网站建设、高性价比北京网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式北京网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖北京地区。费用合理售后完善,十余年实体公司更值得信赖。
[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://×××/technology
网站标题:分布式架构2--CentOs下安装Tomcat7(环境准备)
标题链接:http://cdiso.cn/article/gcocpc.html