阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Linux下离线源码安装配置Tomcat

174次阅读
没有评论

共计 5216 个字符,预计需要花费 14 分钟才能阅读完成。

1、解压

/usr/local # tar xf jdk1.7.0_79.tar -C /usr/local

/usr/local # mv jdk1.7.0_79/ jdk

/usr/local # cd jdk

/usr/local/jdk # ls

COPYRIGHT    THIRDPARTYLICENSEREADME-JavaFX.txt  db      lib      src.zip

LICENSE      THIRDPARTYLICENSEREADME.txt        include  man

README.html  bin                                jre      release

 

2、配置环境变量

#vim /etc/profile

JAVA_HOME=/usr/local/jdk

JRE_HOME=/usr/local/jdk/jre

CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib

PATH=$JAVA_HOME/bin:$PATH

export PATH CLASSPATH JAVA_HOME

 

3、环境变量立即生效并验证

# source /etc/profile

# java -version

java version “1.7.0_79”

Java(TM) SE Runtime Environment (build 1.7.0_79-b15)

Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

 

4、解压 apache-tomcat

# tar zxf apache-tomcat-6.0.37.tar.gz -C /usr/loca

 

/usr/local # cd tomcat

/usr/local/tomcat # ls

LICENSE  RELEASE-NOTES  bin  lib  temp    work

NOTICE  RUNNING.txt    conf  logs  webapps

 

/usr/local/tomcat/bin # ./startup.sh

Using CATALINA_BASE:  /usr/local/tomcat

Using CATALINA_HOME:  /usr/local/tomcat

Using CATALINA_TMPDIR: /usr/local/tomcat/temp

Using JRE_HOME:        /usr/local/jdk

Using CLASSPATH:      /usr/local/tomcat/bin/bootstrap.jar

 

/usr/local/tomcat/bin # ps aux | grep java

root      6753  1.1  3.6 777356 69736 pts/0    Sl  10:59  0:02 /usr/local/jdk/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start

root      6872  0.0  0.0  4520  536 pts/0    S+  11:02  0:00 grep java

linux-svnfile:/usr/local/tomcat/bin # netstat -an | grep 8080

tcp        0      0 :::8080                :::*                    LISTEN

 

5、编写启动脚本

# vi /etc/init.d/tomcat

#!/bin/bash

# chkconfig: 2345 85 15

# vi /etc/init.d/tomcat

# init script for tomcat precesses

 

TOMCAT_HOME=”/usr/local/tomcat”

 

case “$1” in

start)

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

          then

            echo $”Starting Tomcat”

            “$TOMCAT_HOME/bin/startup.sh”

        fi

        ;;

stop)

        if [-f $TOMCAT_HOME/bin/shutdown.sh]

          then

            echo $”Stopping Tomcat”

            “$TOMCAT_HOME/bin/shutdown.sh”

        fi

        ;;

*)

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

        exit 1

        ;;

esac

 

exit 0

 

6、配置 tomcat 开机自启动

# chmod +x /etc/init.d/tomcat

 

# chkconfig –add tomcat

insserv: warning: script ‘S13ITMAgents1’ missing LSB tags and overrides

insserv: warning: script ‘tomcat’ missing LSB tags and overrides

insserv: warning: script ‘tomcat’ missing LSB tags and overrides

insserv: Default-Start undefined, assuming default start runlevel(s) for script `tomcat’

insserv: warning: script ‘ITMAgents1’ missing LSB tags and overrides

insserv: Service network is missed in the runlevels 4 to use service ctrmc

insserv: Service syslog is missed in the runlevels 4 to use service ctrmc

tomcat                    0:off  1:off  2:off  3:on  4:off  5:on  6:off

 

# chkconfig tomcat off

insserv: warning: script ‘S13ITMAgents1’ missing LSB tags and overrides

insserv: warning: script ‘S01tomcat’ missing LSB tags and overrides

insserv: warning: script ‘tomcat’ missing LSB tags and overrides

insserv: warning: script ‘tomcat’ missing LSB tags and overrides

insserv: warning: script ‘ITMAgents1’ missing LSB tags and overrides

linux-svnfile:/home/apps # chkconfig –list tomcat

tomcat                    0:off  1:off  2:off  3:off  4:off  5:off  6:off

 

# chkconfig tomcat on

insserv: warning: script ‘S13ITMAgents1’ missing LSB tags and overrides

insserv: warning: script ‘tomcat’ missing LSB tags and overrides

insserv: warning: script ‘tomcat’ missing LSB tags and overrides

insserv: Default-Start undefined, assuming default start runlevel(s) for script `tomcat’

insserv: warning: script ‘ITMAgents1’ missing LSB tags and overrides

insserv: Service network is missed in the runlevels 4 to use service ctrmc

insserv: Service syslog is missed in the runlevels 4 to use service ctrmc

linux-svnfile:/home/apps # chkconfig –list tomcat

tomcat                    0:off  1:off  2:off  3:on  4:off  5:on  6:off

 

# ps aux | grep java

root      7416 17.8  3.4 711288 67208 pts/1    Sl  11:19  0:01 /usr/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start

root      7442  0.0  0.0  4520  540 pts/1    S+  11:19  0:00 grep java

linux-svnfile:/home/apps # service tomcat stop

Stopping Tomcat

Using CATALINA_BASE:  /usr/local/tomcat

Using CATALINA_HOME:  /usr/local/tomcat

Using CATALINA_TMPDIR: /usr/local/tomcat/temp

Using JRE_HOME:        /usr

Using CLASSPATH:      /usr/local/tomcat/bin/bootstrap.jar

 

# ps aux | grep java

root      7480  0.0  0.0  4520  540 pts/1    S+  11:19  0:00 grep java

更多 Tomcat 相关教程见以下内容

CentOS 6.6 下安装配置 Tomcat 环境  http://www.linuxidc.com/Linux/2015-08/122234.htm

RedHat Linux 5.5 安装 JDK+Tomcat 并部署 Java 项目  http://www.linuxidc.com/Linux/2015-02/113528.htm 

Tomcat 权威指南(第二版)(中英高清 PDF 版 + 带书签)  http://www.linuxidc.com/Linux/2015-02/113062.htm 

Tomcat 安全配置与性能优化 http://www.linuxidc.com/Linux/2015-02/113060.htm 

Linux 下使用 Xshell 查看 Tomcat 实时日志中文乱码解决方案 http://www.linuxidc.com/Linux/2015-01/112395.htm 

CentOS 64-bit 下安装 JDK 和 Tomcat 并设置 Tomcat 开机启动操作步骤 http://www.linuxidc.com/Linux/2015-01/111485.htm 

CentOS 6.5 下安装 Tomcat  http://www.linuxidc.com/Linux/2015-01/111415.htm 

Tomcat 中 session 的管理机制  http://www.linuxidc.com/Linux/2016-09/135072.htm

Tomcat 的详细介绍:请点这里
Tomcat 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-03/141429.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计5216字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中