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

CentOS7下安装Tomcat

时间:2017-11-10 18:40:04      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:tomcat

1。安装JDK

官网下载,或者用winscp工具下载后解压

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-i586.tar.gz

tar zxvf jdk-8u65-linux-x64.tar.gz

mv jdk1.8.0_73 /usr/local/jdk1.8.0_73

 

vi /etc/profile.d/java.sh  //加入如下配置

JAVA_HOME=/usr/local/jdk1.8.0_73

JAVA_BIN=/usr/local/jdk1.8.0_73/bin

JRE_HOME=/usr/local/jdk1.8.0_73/jre

PATH=$PATH:/usr/local/jdk1.8.0_73/bin:/usr/local/jdk1.8.0_73/jre/bin

CLASSPATH=/usr/local/jdk1.8.0_73/jre/lib:/usr/local/jdk1.8.0_73/lib:/usr/local/jdk1.8.0_73/jre/lib/charsets.jar

source  /etc/profile.d/java.sh

如果以上配置成功,则下面的命令可以看到java的版本:

java  -version


2。安装tomcat

cd /usr/local/src/;

wget http://www.lishiming.net/data/attachment/forum/apache-tomcat-7.0.14.tar.gz

tar zxvf apache-tomcat-7.0.14.tar.gz

mv apache-tomcat-7.0.14 /usr/local/tomcat (tomcat目录不用创建)

cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat

vim /etc/init.d/tomcat  //从第二行加入

# chkconfig: 2345 63 37

# description: tomcat server init script
# Source Function Library

. /etc/init.d/functions

JAVA_HOME=/usr/local/jdk1.8.0_73

CATALINA_HOME=/usr/local/tomcat


chmod 755 /etc/init.d/tomcat

service tomcat start(systemctl start tomcat)

ps aux |grep tomcat

netstat -lnp |grep 8080


关闭防火墙:

iptables -F

setenforce 0


systemctl disable firewalld.service #禁止firewall开机启动

systemctl stop firewalld


通过以下地址查看tomcat是否运行正常:
http://192.168.15.231:8080/
看到tomcat系统界面,说明安装成功!

本文出自 “IT屌丝” 博客,请务必保留此出处http://68686789.blog.51cto.com/10438688/1980714

CentOS7下安装Tomcat

标签:tomcat

原文地址:http://68686789.blog.51cto.com/10438688/1980714

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