Tomca8.5安装
安装编译所需要的gcc
yum -y install gcc
下载JDK
https://www.oracle.com/java/technologies/downloads/
jdk-8u391-linux-x64.tar.gz
安装JDK
tar xf jdk-8u171-linux-x64.tar.gz
chmod 755 jdk1.8.0_391
mv jdk1.8.0_391 /usr/java/
配置JDK
vi /etc/profile
在最后加入
export JAVA_HOME=/usr/java/jdk1.8.0_391 #jdk安装目录
export PATH=$JAVA_HOME/bin:$PATH
使配置生效
source /etc/profile
验证安装
java -version
java version "1.8.0_391"
下载tomcat Core安装包
https://tomcat.apache.org/download-80.cgi
apache-tomcat-8.5.31.tar.gz
编译安装
tar -zxvf apache-tomcat-8.5.31.tar.gz
mv apache-tomcat-8.5.31/ /usr/lcoal/tomcat/
cd /usr/local/tomcat/bin
tar -zxvf commons-daemon-native.tar.gz
cd commons-daemon-1.0.15-native-src/unix/
./configure
make
cp jsvc ../..
cd ../..
cp daemon.sh /etc/init.d/tomcat
修改/etc/init.d/tomcat
vi /etc/init.d/tomcat
#!/bin/sh
下添加
# chkconfig: 2345 64 36
# description: Tomcat Server.
# resolve links - $0 may be a softlink
下添加
JAVA_HOME=/usr/java/jdk1.8.0_391/
CATALINA_HOME=/usr/local/tomcat
CATALINA_BASE=$CATALINA_HOME
DAEMON_HOME=/usr/local/tomcat/bin
TOMCAT_USER=root
# Use the maximum available, or set MAX_FD != -1 to use that
test ".$MAX_FD" = . && MAX_FD="maximum"
# Setup parameters for running the jsvc
#
#test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat
# WEB CHANGE
# 修改TOMCAT_USER使用上面配置的TOMCAT_USER变量
test ".$TOMCAT_USER" = . && TOMCAT_USER=$TOMCAT_USER
# Add on extra jar files to CLASSPATH
test ".$CLASSPATH" != . && CLASSPATH="$CLASSPATH:"
CLASSPATH="$CLASSPATH$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar"
# WEB CHANGE
#test ".$CATALINA_OUT" = . && CATALINA_OUT="$CATALINA_BASE/logs/catalina-daemon.out"
#修改tomcat输出的文件名catalina-daemon.out为catalian.out
test ".$CATALINA_OUT" = . && CATALINA_OUT="$CATALINA_BASE/logs/catalina.out"
修改tomcat的启动参数
在/usr/local/tomcat/bin
中新建setenv.sh
#!/bin/bash
export JAVA_OPTS='-server -Xms4096m -Xmx4096m -Djava.awt.headless=true'
启动tomcat
service tomcat start
添加tomcat自启动
chkconfig --levels 2345 tomcat on
防火墙打开端口
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --reload
外部访问http://ip:8080测试。
停止tomcat
service tomcat stop
如果以上命令卡顿时间过长,可能无法停止tomcat,需要使用ps -ef | grep tomcat查看正在运行的tomcat,执行kill -9 结束进程
标签:bin,CATALINA,TOMCAT,tomcat,Tomca8.5,USER,HOME,安装 From: https://www.cnblogs.com/zdtiio/p/17928232.html