tomcat-7.0源码安装配置

Tomcat标准部署规范

 

系统版本:CentOS6.5

Tomcat版本:tomcat-7.0.55

Tomcat下载地址:https://tomcat.apache.org/download-70.cgi(下载好用xftp上传至服务器/usr/src/)

提示:安装好常用工具,卸载已安装tomcat旧版本,切记必须安装jdk

 

解压源码包:

tar zxvfapache-tomcat-7.0.69.tar.gz –C /usr/local/(将源码包解压至/usr/local/

 

新增配置变量:

vi/etc/profile(在末尾新增以下几行变量)

JAVA_HOME=/usr/local/jdk1.7.0_79

JRE_HOME=/usr/local/jdk1.7.0_79/jre

PATH=$JAVA_HOME/bin:JRE_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

export JAVA_HOME  JRE_HOME PATH CLASSPATH

exportJAVA_HOME=/usr/local/jdk1.7.0_79

exportCALSSPATH=$JAVA_HOME/lib/*.*

exportTOMCAT_HOME=/usr/local/tomcat

export CATALINA_HOME=/usr/local/tomcat

exportPATH=$PATH:$JAVA_HOME/bin:$TOMCAT_HOME/bin

 

source/etc/profile(即时生效配置文件)

 

添加开机启动Tomcat脚本:

vi /etc/rc.d/init.d/tomcat(复制以下配置到/etc/rc.d/init.d/tomcat

#!/bin/bash

# /etc/rc.d/init.d/tomcat

# init script for tomcat precesses

# processname: tomcat

# description: tomcat is a j2seserver

# chkconfig: 2345 86 16

# description: Start up the Tomcatservlet engine.

if [ -f /etc/init.d/functions ];then

. /etc/init.d/functions

elif [ -f/etc/rc.d/init.d/functions ]; then

. /etc/rc.d/init.d/functions

else

echo -e "\atomcat: unable tolocate functions lib. Cannot continue."

exit -1

fi

RETVAL=$?

CATALINA_HOME="/usr/local/tomcat"#tomcat安装目录

case "$1" in

start)

if [ -f$CATALINA_HOME/bin/startup.sh ];

then

echo $"Starting Tomcat"

$CATALINA_HOME/bin/startup.sh

fi

;;

stop)

if [ -f$CATALINA_HOME/bin/shutdown.sh ];

then

echo $"Stopping Tomcat"

$CATALINA_HOME/bin/shutdown.sh

fi

;;

*)

echo $"Usage: $0{start|stop}"

exit 1

;;

esac

exit $RETVAL

 

添加权限:

chmod 755 /etc/rc.d/init.d/tomcat

chkconfig –add tomcat

chkconfig tomcat on

 

vim/usr/local/tomcat7/bin/catalina.sh

exportJAVA_HOME=/usr/java/jdk1.7.0_79

export CATALINA_HOME=/usr/local/tomcat

export CATALINA_BASE=/usr/local/tomcat

export CATALINA_TMPDIR=/usr/local/tomcat/temp

启动服务:

service tomcat start

 

ps -ef | grep tomcat

tomcat-7.0源码安装配置_第1张图片

说明:看到以上信息,说明tomcat安装成功。

 

你可能感兴趣的:(Linux,服务应用)