centos 安裝tomcat8

下載tomcat   http://tomcat.apache.org/apache

apache-tomcat-8.0.30.tar.gz 包bootstrap

解壓  tar -zxvf apache-tomcat-8.0.30.tar.gzvim

刪除安裝包tomcat

rm -rf apache-tomcat-8.0.30.tar.gzbash

重命名.net

mv /usr/local/apache-tomcat-8.0.30 tomcatip

啓動ci

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

Using CATALINA_BASE:   /usr/local/tomcatit

Using CATALINA_HOME:   /usr/local/tomcat

Using CATALINA_TMPDIR: /usr/local/tomcat/temp

Using JRE_HOME:        /usr/jdk1.7.0_25

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

uli.jarTomcat started.

啓動成功

接下來Tomcat 配置爲 Linux Service

Configure Tomcat-7

開機啓動

cp /usr/local/tomcat/bin/catalina.sh /etc/init.d

mv /etc/init.d/catalina.sh tomcat

 

--------------------

 vim /etc/init.d/tomcat

在#!/bin/bash下輸入

# chkconfig: 2345 10 90

# description:Tomcat service

在#OS specific support................上輸入

CATALINA_HOME=/usr/local/tomcat

    JAVA_HOME=/usr/jdk1.7.0_25

保存並退出文件

      --------------------

[root@localhost init.d]chmod +x tomcat

[root@localhost init.d]cd /

[root@localhost /]vim /etc/profile

      --------------------  

在最後一行輸入

export JAVA_HOME=/usr/jdk1.7.0_25

export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar  

export PATH=$JAVA_HOME/bin:$PATH

 

export CATALINA_HOME=/usr/local/tomcat

export CLASSPATH=.:$CLASSPATH:$CATALINA_HOME/lib

export PATH=$PATH:$CATALINA_HOME/bin

保存並退出文件

      --------------------

 

[root@localhost /]source /etc/profile

[3] Add tomcat to service list

[root@localhost /]chkconfig --add tomcat

[4] Check service list

[root@localhost /]chkconfig --list tomcat

tomcat      0:關閉 1:關閉 2:啓用 3:啓用 4:啓用 5:啓用 6:關閉

[5] Test tomcat service

[root@localhost /]service tomcat

      --------------------

[root@localhost /]service tomcat start

Using CATALINA_BASE:   /usr/local//tomcat

Using CATALINA_HOME:   /usr/local//tomcat

Using CATALINA_TMPDIR: /usr/local//tomcat/temp

Using JRE_HOME:        /usr/jdk1.7.0_25

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

i.jarTomcat started.

相關文章
相關標籤/搜索