(1)新建一个文件夹放置要下载的tomcat:
mkdir /software
进入software目录
cd /software
(2)下载tomcat放置在software目录下
wgethttp://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 instart) 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' ;;esacexit 0
退出保存把/etc/init.d/tomcat7设置成可执行sudo chmod +x /etc/init.d/tomcat7将tomcat7加入服务sudo update-rc.d tomcat7 defaults
新闻热点
疑难解答