Linux上安装tomcat

安装tomcat
软件:apache-tomcat-7.0.70.tar.gz
压缩包在
/usr/yanghai
解压到
/usr/local/tomcat7
 
启动tomcat:
/usr/local/tomcat7/apache-tomcat-7.0.70/bin
sh  startup.sh
 
启动日志:
1 [root@iZ28fg6zc2zZ bin]# sh startup.sh
2 Using CATALINA_BASE:   /usr/local/tomcat7/apache-tomcat-7.0.70
3 Using CATALINA_HOME:   /usr/local/tomcat7/apache-tomcat-7.0.70
4 Using CATALINA_TMPDIR: /usr/local/tomcat7/apache-tomcat-7.0.70/temp
5 Using JRE_HOME:        /usr/local/java/jdk1.8.0_101
6 Using CLASSPATH:       /usr/local/tomcat7/apache-tomcat-7.0.70/bin/bootstrap.jar:/usr/local/tomcat7/apache-tomcat-7.0.70/bin/tomcat-juli.jar
7 Tomcat started.

 

到日志文件中看一下:
cd /usr/local/tomcat7/apache-tomcat-7.0.70/logs/
 
tail -f catalina.out
 1 Aug 22, 2016 8:10:33 PM org.apache.catalina.startup.HostConfig deployDirectory
 2 INFO: Deploying web application directory /usr/local/tomcat7/apache-tomcat-7.0.70/webapps/manager
 3 Aug 22, 2016 8:10:33 PM org.apache.catalina.startup.HostConfig deployDirectory
 4 INFO: Deployment of web application directory /usr/local/tomcat7/apache-tomcat-7.0.70/webapps/manager has finished in 135 ms
 5 Aug 22, 2016 8:10:33 PM org.apache.coyote.AbstractProtocol start
 6 INFO: Starting ProtocolHandler ["http-bio-8080"]
 7 Aug 22, 2016 8:10:33 PM org.apache.coyote.AbstractProtocol start
 8 INFO: Starting ProtocolHandler ["ajp-bio-8009"]
 9 Aug 22, 2016 8:10:33 PM org.apache.catalina.startup.Catalina start
10 INFO: Server startup in 1910 ms
看启动成功,浏览器访问:ip+端口
出现猫猫,那么久ok了。
 
注意这里会遇到一些问题,这里安装的比较顺利,有的安装过程中,会遇到tomcat启动成功但是浏览器不能访问的情况,这里需要考虑的是,防火墙是否开放了8080端口;
 
查看防火墙状态:
/etc/init.d/iptables status
#开启8011端口 
/sbin/iptables -I INPUT -p tcp --dport 8011 -j ACCEPT 
 #保存配置 
/etc/rc.d/init.d/iptables save
#重启服务 
/etc/rc.d/init.d/iptables restart
 
还要注意一点是安装的环境,此例的安装环境是centOS6.5,若在centOS7.5上安装,查看防火墙的命令也有所不同,可看参考资料:
 

 

以上内容都本人在16年有段时间的安装笔记记录,暂时放在这里,如有错误欢迎各位指正,谢谢!

 

 

posted @ 2017-04-27 14:32  heyLuer  阅读(219)  评论(0编辑  收藏  举报