1、下载tomcat

wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.16/bin/apache-tomcat-8.5.16.tar.gz

2、解压tomcat

tar -xzf  apache-tomcat-8.5.16.tar.gz -C /usr/local

 

修改catalina.sh 将196行修改成197行内容,注释掉399,414,426行,添加413,425

vim apache-tomcat-7.0.77/bin/catalina.sh

189 # Add on extra jar files to CLASSPATH
190 if [ ! -z "$CLASSPATH" ] ; then
191 CLASSPATH="$CLASSPATH":
192 fi
193 CLASSPATH="$CLASSPATH""$CATALINA_HOME"/bin/bootstrap.jar
194
195 if [ -z "$CATALINA_OUT" ] ; then
196 # CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out
197 CATALINA_OUT="$CATALINA_BASE"/logs/catalina.%Y-%m-%d.out
198 fi
199
200 if [ -z "$CATALINA_TMPDIR" ] ; then
201 # Define the java.io.tmpdir to use for Catalina
202 CATALINA_TMPDIR="$CATALINA_BASE"/temp
203 fi

399 # touch "$CATALINA_OUT"
400 if [ "$1" = "-security" ] ; then
401 if [ $have_tty -eq 1 ]; then
402 echo "Using Security Manager"
403 fi
404 shift
405 eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
406 -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
407 -Djava.security.manager \
408 -Djava.security.policy=="\"$CATALINA_BASE/conf/catalina.policy\"" \
409 -Dcatalina.base="\"$CATALINA_BASE\"" \
410 -Dcatalina.home="\"$CATALINA_HOME\"" \
411 -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
412 org.apache.catalina.startup.Bootstrap "$@" start \
413 | /usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.out.%Y-%m-%d.out>> /dev/null & 添加
414 # >> "$CATALINA_OUT" 2>&1 "&"
415 else


419 eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
420 -Djava.endorsed.dirs="\"$JAVA_ENDORSED_DIRS\"" -classpath "\"$CLASSPATH\"" \
421 -Dcatalina.base="\"$CATALINA_BASE\"" \
422 -Dcatalina.home="\"$CATALINA_HOME\"" \
423 -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
424 org.apache.catalina.startup.Bootstrap "$@" start \
425 | /usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.out.%Y-%m-%d.out>> /dev/null & 添加
426 # >> "$CATALINA_OUT" 2>&1 "&"
427fi


[root@localhost bin]# ./catalina.sh start
Using CATALINA_BASE: /app/apache-tomcat-7.0.77
Using CATALINA_HOME: /app/apache-tomcat-7.0.77
Using CATALINA_TMPDIR: /app/apache-tomcat-7.0.77/temp
Using JRE_HOME: /app/jdk1.7.0_79
Using CLASSPATH: /app/apache-tomcat-7.0.77/bin/bootstrap.jar:/app/apache-tomcat-7.0.77/bin/tomcat-juli.jar
Tomcat started.
[root@localhost bin]# service tomcat stop
[root@localhost bin]# service tomcat start
可以通过./catalina.sh start 来查看配置文件是否正确;这样在/usr/local/tomcat/logs每天会自动生成catalina.%Y-%m-%d.out文件

[root@yunying02f0903p103@../logs]#ll
total 3840
-rw-r--r-- 1 root root 6791 May 9 16:16 catalina.2017-05-09.log
-rw-r--r-- 1 root root 352 May 10 09:07 catalina.2017-05-10.log
-rw-r--r-- 1 root root 2602353 May 9 23:10 catalina.out.2017-05-09.out
-rw-r--r-- 1 root root 1215958 May 10 10:09 catalina.out.2017-05-10.out
-rw-r--r-- 1 root root 0 May 9 16:10 host-manager.2017-05-09.log
-rw-r--r-- 1 root root 1002 May 9 16:10 localhost.2017-05-09.log
-rw-r--r-- 1 root root 50321 May 9 23:10 localhost_access_log.2017-05-09.txt
-rw-r--r-- 1 root root 31554 May 10 10:09 localhost_access_log.2017-05-10.txt
-rw-r--r-- 1 root root 0 May 9 16:10 manager.2017-05-09.log

posted on 2017-05-09 17:46  绿旋风-1  阅读(708)  评论(0编辑  收藏  举报