Ubuntu下安装Tomcat

1.下载tomcat

http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.28/bin/
选择Ubuntu Linux适用版本,即apache-tomcat-6.0.28.tar.gz文件

2.解压apache-tomcat-6.0.28.tar.gz

#sudo tar -zxvf '/你的路径/apache-tomcat-6.0.28.tar.gz'

3.移动解压文件夹apache-tomcat-6.0.28到/usr/local/下

#sudo mv '/你的路径/apache-tomcat-6.0.28' '/usr/local'

4.配置JDK

#sudo gedit /usr/local/apache-tomcat-6.0.28/bin/startup.sh

在stratup.sh中加入如下文字

#config JDK
JAVA_HOME=/usr/jdk1.7.0
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
TOMCAT_HOME=/usr/local/apache-tomcat-6.0.28

5.启动tomcat

#cd /usr/local/apache-tomcat-6.0.28/bin

#sudo ./startup.sh

6.到localhost:8080下,看看启动成功

7.其他配置,可以配置conf/server.xml文件,例如端口号等,
输入命令:sudo gedit /usr/local/apache-tomcat-6.0.28/conf/server.xml
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"/>

将监听端口改成80,添加URIEncoding="UTF-8"以支持中文参数传递处理。
停止shutdown服务器命令是:
sudo ./shutdown.sh

感谢原文:http://www.linuxidc.com/Linux/2010-07/27293.htm

posted on 2013-03-21 14:59  chlde2500  阅读(213)  评论(0编辑  收藏  举报

导航