1 安装jdk
下载jdk-8u121-linux-x64.tar.gz
mkdir /usr/local/java/
解压到/usr/local/java/
cd /usr/local/java/; ln -s jdk1.8.0_121 jdk
2 安装tomcat
解压apache-tomcat-8.5.15.tar.gz到/usr/local/tomcat
3 编辑/etc/profile 添加如下内容:
## JAVA
export JAVA_HOME=/usr/local/java/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
## TOMcat
export CATALINA_HOME=/usr/local/tomcat
## PATH
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:$JAVA_HOME/bin
#################
. /etc/prof
4 cp /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
编辑/etc/init.d/tomcat, 在#!/bin/sh 下添加下面3行
#!/bin/sh
JAVA_HOME=/usr/local/java/jdk
CATALINA_HOME=/usr/local/tomcat
# chkconfig: - 95 15
########
chmod +x /etc/init.d/tomcat
chkconfig tomcat on; service tomcata start
时间: 2024-10-15 20:10:48