1 、tomcat6 下载
地址:http://archive.apache.org/dist/tomcat/tomcat-6/
版本:v6.0.29
2 、在/usr/local/share 下创建tomcat6 目录
sudo mkdir /usr/local/share/tomcat6
3 、复制安装文件到/usr/local/share/tomcat6/ 目录下,并解压
sudo cp /home/silver/ 下载/apache-tomcat-6.0.29.tar.gz /usr/local/share/tomcat6/ apache-tomcat-6.0.29.tar.gz
sudo tar -zxvf apache-tomcat-6.0.29.tar.gz
4 、分别配置startup.sh 和shutdown.sh 文件
sudo gedit /usr/local/share/tomcat6/apache-tomcat-6.0.29/bin/startup.sh
和
sudo gedit /usr/local/share/tomcat6/apache-tomcat-6.0.29/bin/shutdown.sh
在exec "$PRGDIR"/"$EXECUTABLE" start "$@" 之前加入以下配置内容
#environment varible for tomcat
JAVA_HOME=/usr/lib/jvm/java/jdk1.6.0_22
JRE_HOME=/usr/lib/jvm/java/jdk1.6.0_22/jre
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
CLASSPATH=.:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
TOMCAT_HOME=/usr/local/share/tomcat6/apache-tomcat-6.0.29
5 、测试是否能正常使用
cd /usr/local/share/tomcat6/apache-tomcat-6.0.29/bin/
sudo ./startup.sh
输出:
Using CATALINA_BASE: /usr/local/share/tomcat6/apache-tomcat-6.0.29
Using CATALINA_HOME: /usr/local/share/tomcat6/apache-tomcat-6.0.29
Using CATALINA_TMPDIR: /usr/local/share/tomcat6/apache-tomcat-6.0.29/temp
Using JRE_HOME: /usr/lib/jvm/java/jdk1.6.0_22
Using CLASSPATH: /usr/local/share/tomcat6/apache-tomcat-6.0.29/bin/bootstrap.jar
则表示服务已经正常启动,输入http://localhost:8080/ 查看
6 、关闭服务
sudo ./shutdown.sh
7 、配置conf/server.xml 文件
cd /usr/local/share/tomcat6/apache-tomcat-6.0.29/conf
sudo gedit server.xml
编辑
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
将端口改成 8090 ,添加 URIEncoding="UTF-8" 以支持中文参数传递处理
<Connector port="8090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"/>