首先要配置好JDK,参考:http://www.cnblogs.com/yshyee/p/3352154.html
到http://tomcat.apache.org/download-60.cgi下载apache-tomcat-6.0.37.tar.gz,将其解压。
1:配置JAVA_HOME 路径
sudo vim apache-tomcat-6.0.37/bin/catalina.sh
添加:JAVA_HOME=/usr/lib/jvm/jdk1.7.0_40 #修改成您的jdk路径
2:Tomcat默认端口是8080,如果存在端口冲突,可以修改端口号:
sudo vim apache-tomcat-6.0.37/conf/server.xml
将8080换成你的端口号:
<Connector port="" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
3:进入bin目录,启动服务
cd apache-tomcat-6.0.37/bin/
sudo ./startup.sh
提示:
Using CATALINA_BASE: /home/wzh/apache-tomcat-6.0.37
Using CATALINA_HOME: /home/wzh/apache-tomcat-6.0.37
Using CATALINA_TMPDIR: /home/wzh/apache-tomcat-6.0.37/temp
Using JRE_HOME: /usr/lib/jvm/jdk1.7.0_40
Using CLASSPATH: /home/wzh/apache-tomcat-6.0.37/bin/bootstrap.jar
则表示成功!
4:在浏览器输入:http://localhost:9090 就会进入Tomcat 界面!
5:要停止Tomcat就输入:
cd apache-tomcat-6.0.37/bin/
sudo ./shutdown.sh