首页 > 代码库 > Ubuntu下安装Tomcat

Ubuntu下安装Tomcat

 

0. 安装文件

http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.28/bin/apache-tomcat-6.0.28.tar.gz 

 

1. 下载安装文件

under /usr/local/

wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.28/bin/apache-tomcat-6.0.28.tar.gz 

 

2. 解压安装包

tar -zxvf apache-tomcat-6.0.28.tar.gz

 

3. 配置java环境变量 及tomcat 环境变量

 java 开发环境设置请参考这篇文章 Install Java on Ubuntu server

 添加TOMCAT_HOME 到配置文件 /etc/environment 如下

TOMCAT_HOME=/usr/local/apache-tomcat-6.0.28

 

4. 启动Tomcat

cd /usr/local/apache-tomcat-6.0.28/bin,
 ./startup.sh
启动tomcat服务器,

若出现:
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.28
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.28
Using CATALINA_TMPDIR:
/usr/local/apache-tomcat-6.0.28/temp
Using JRE_HOME:       
/usr/lib/sunJVM/JDK/jdk1.6.0_20
Using CLASSPATH:      
/usr/local/apache-tomcat-6.0.28/bin/bootstrap.jar
代码,则基本上正常启动了,输入http://localhost:8080/查看,看看能否出现熟悉的tomcat欢迎界面。 

详细的log信息可以在以下文件夹中找到

/usr/local/apache-tomcat-6.0.28/logs

 

5、其他配置,可以配置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

reference documents

http://exzhengjz.blog.163.com/blog/static/19077604120117315315159/

 

Ubuntu下安装Tomcat