标签:
CentOS7 Tomcat安装
上传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
标签:
原文地址:http://www.cnblogs.com/tjpanda88/p/4297287.html