码迷,mamicode.com
首页 > 其他好文 > 详细

centos6中搭建tomcat

时间:2018-08-03 14:57:12      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:uil   netstat   list   runtime   bit   available   ota   host   height   

一、安装jdk

[root@tomcat ~]# yum -y list java* 
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirror.bit.edu.cn
 * updates: mirrors.aliyun.com
Available Packages
java-1.7.0-openjdk-javadoc.noarch                      1:1.7.0.161-2.6.12.0.el6_9                updates
java-1.7.0-openjdk-src.x86_64                          1:1.7.0.161-2.6.12.0.el6_9                updates
java-1.8.0-openjdk.x86_64                              1:1.8.0.161-3.b14.el6_9                   updates
java-1.8.0-openjdk-debug.x86_64                        1:1.8.0.161-3.b14.el6_9                   updates 
[root@tomcat ~]# yum install java-1.8.0-openjdk.x86_64 -y
[root@tomcat ~]# java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

二、安装Tomcat

[root@tomcat ~]# mkdir -p tools
[root@tomcat ~]# cd tools/
[root@tomcat tools]# ll
total 8780
-rw-r--r-- 1 root root 8989099 Feb 28 00:31 apache-tomcat-7.0.81.tar.gz
[root@tomcat tools]# tar xf apache-tomcat-7.0.81.tar.gz -C /usr/local/
[root@tomcat ~]# cd /usr/local/
[root@tomcat local]# mv apache-tomcat-7.0.81 tomcat

三、启动Tomcat

[root@tomcat local]# /usr/local/tomcat/bin/startup.sh configtest	# 检查配置文件是否正确
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@tomcat local]# /usr/local/tomcat/bin/startup.sh start			# 启动
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@tomcat ~]# netstat -lntup|grep java
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      1612/java           
tcp        0      0 :::8009                     :::*                        LISTEN      1612/java           
tcp        0      0 :::8080                     :::*                        LISTEN      1612/java  

四、网页访问

[root@tomcat ~]# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
[root@tomcat ~]# /etc/init.d/iptables restart

  技术分享图片

 

 

 

 

 

centos6中搭建tomcat

标签:uil   netstat   list   runtime   bit   available   ota   host   height   

原文地址:https://www.cnblogs.com/linu/p/8481674.html

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