设为首页 收藏本站
查看: 902|回复: 0

[经验分享] 离线源码安装配置tomcat

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-9-22 08:49:39 | 显示全部楼层 |阅读模式
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



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-275698-1-1.html 上篇帖子: 实战Tomcat安装配置实现负载均衡 下篇帖子: tomcat访问页面显示404错误 离线
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表