1.下载及安装
$: wget http://apache.tradebit.com/pub/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz
$: tar xvzf apache-tomcat-6.0.32.tar.gz
$: sudo mv apache-tomcat-6.0.32 /usr/local/tomcat
$: sudo chmod -R 755 /usr/local/tomcat
2.启动时运行
$: sudo nano /etc/init.d/tomcat
# Tomcat server auto-start script
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
3. 设置可执行权限
$: sudo chmod 755 /etc/init.d/tomcat
$: sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
$: sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
4.启动和关闭tomcat
sh /usr/local/tomcat/bin/startup.sh
sh /usr/local/tomcat/bin/shutdown.sh
5.web项目部署方式
1.在server.xml中指定
1.修改conf/server.xml文件
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context path="/diary" docBase="/home/diary/WebContent/" debug="0" reloadbale="true"/>
</Host>
在<Host></Host>之间添加<Context>标签,path指定虚拟目录名(网络访问路径),docBase指定实际物理地址路径(注意是web项目的WebContent级路径)。
2.如在访问的时候出现404界面,并提示:"the requested resource is not available",则须修改conf/web.xml文件
<init-param>
<param-name>listings</param-name>
<!-- modify by zl-->
<!--
<param-value>false</param-value>
-->
<param-value>true</param-value>
</init-param>
2.直接部署在webapps目录
待续。。。。
3.创建一个context文件
在conf下创建catalina/localhost目录,并在该目录下创建一个xml文件,该文件名必须和其内部<Context>标签中的虚拟目录名相同。如:
diary.xml
<Context path="/diary" docBase="/workspace/diary/WebContent" debug="0" privileged="true"></Context>
4.动态部署
待续。。。。