安装 tomat

 

 

(1)新建一个文件夹放置要下载的tomcat:

mkdir /software

进入software目录

cd /software

(2)下载tomcat放置在software目录下

wget  http://apache.fayea.com/apache-mirror/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.tar.gz

(3)下载好,解压到到/software/workspace目录下

     解压

    tar zxvf apache-tomcat-7.0.54.tar.gz

    创建workspace文件夹

    mkdir /software/workspace

    chmod 777 /software/workspace 

   移动到/software/workspace目录下

    mv  apache-tomcat-7.0.54  /software/workspace/

(4)配置环境

 vi /etc/profile

  最下方加入:

  CATALINA_HOME=/software/workspace/tomcat-7.0.54

  export CATALINA_HOME

(5)vi /software/workspace/tomcat-7.0.54/bin/catalina.sh

 # OS specific support. $var _must_ be set to either true or false.

  在这行上面再定义一次CATALINA_HOME以及JAVA_HOME:

  CATALINA_HOME=/software/workspace/tomcat-7.0.54(tomcat放置的位置)

  JAVA_HOME=/usr/java/jdk1.7.0_55(jdk的路径)

  保存退出

(6)配置开机自启动

 //tomcat放置在/software/workspace/tomcat-7.0.54

编写启动文件/etc/init.d/tomcat7 tomcat7文件内容如下

#!/bin/sh
#tomcat auto-start

#设置JAVA_HOME了
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun 
 
case $1 in
start)
 sh /software/workspace/tomcat-7.0.54/bin/startup.sh 
 ;;
stop)
 sh /software/workspace/tomcat-7.0.54/bin/shutdown.sh
 ;;
restart)
 sh /software/workspace/tomcat-7.0.54/bin/shutdown.sh
 sh /software/workspace/tomcat-7.0.54/bin/startup.sh
 ;;
*)
 echo 'Usage:tomcat7 start|stop|restart'
 ;;
esac
exit 0


 退出保存
把/etc/init.d/tomcat7设置成可执行
 sudo chmod +x /etc/init.d/tomcat7
将tomcat7加入服务
 sudo update-rc.d tomcat7 defaults

posted @ 2014-07-01 15:55  吴伟都  阅读(350)  评论(0编辑  收藏  举报