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

CentOS7 Tomcat安装

时间:2015-02-22 01:38:56      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:

CentOS7 Tomcat安装

CentOS7 Tomcat安装

Download

  • Tomcat下载apache-tomcat-8.0.18.tar.gz

Install

  • 安装

上传RPM文件到/tmp目录下

mkdir /opt/tomcat
cd
/opt/tomcat
tar
-zxvf /tmp/apache-tomcat-8.0.18.tar.gz
ln
-sf /opt/tomcat/apache-tomcat-8.0.18/opt/tomcat/latest
ln
-sf /opt/tomcat/latest /opt/tomcat/default

将以下设定加入/opt/tomcat/default/conf/tomcat-users.xml

<rolerolename="manager-gui"/>
<userusername="manager"password="manager"roles="manager-gui"/>

新建用户

useradd -r tomcat --shell /bin/false
chown
-hR tomcat:/opt/tomcat
  • 开机启动

jsvc解压

cd /opt/tomcat/default/bin
tar zxvf commons
-daemon-native.tar.gz
cd commons
-daemon-1.0.15-native-src/unix/
./configure
make
cp jsvc
../..

新建/etc/init.d/tomcat

#!/bin/sh

# chkconfig: - 80 20
# Description: Tomcat

CATALINA_HOME
=/opt/tomcat/default
TOMCAT_USER
=tomcat
JAVA_HOME
=/usr/java/default

"$CATALINA_HOME/bin/daemon.sh"\
--java-home "$JAVA_HOME"\
--catalina-home "$CATALINA_HOME"\
--tomcat-user "$TOMCAT_USER"\
$1
exit $?

赋予执行权限

chmod +x /etc/init.d/tomcat

设定开机启动

chkconfig tomcat on
  • 防火墙

新建文件/usr/lib/firewalld/services/tomcat.xml

<?xml version="1.0" encoding="utf-8"?>
<service>
       
<short>Tomcat</short>
       
<description>Apache Tomcat Web Application Container</description>
       
<portprotocol="tcp"port="8080"/>
</service>

修改防火墙设定

firewall-cmd --permanent --add-service=tomcat
firewall
-cmd --reload

CentOS7 Tomcat安装

标签:

原文地址:http://www.cnblogs.com/tjpanda88/p/4297287.html

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