Installing Tomcat on Ubuntu
关键字: utuntu tomcat installhttp://doc.gwos.org/index.php/Install_tomcat_5.5
Versions:
- SDK: 1.5
- JRE: 1.5
- Tomcat: 5.5
Step 1 – Install JRE and SDK
Use the advice here to install these packages
You can verify that both items were installed corectly, by checking that you get a response when typing in terminal:
Code: |
|
java -version javac -help |
Step 2 – Get tomcat
Download tomcat 5.5 from http://jakarta.apache.org/site/downloads/
In this example I am using jakarta-tomcat-5.5.9.tar.gz
Uncompress the file:
Code: |
|
tar xvfz jakarta-tomcat-5.5.9.tar.gz |
N.B. To make things simpler I also renamed the package to just 'tomcat'. If you do not do this, make sure you adjust these tutorial instructions to the name of your package whenever you see 'tomcat' written.
Step 3 – Add tomcat
Place the uncompressed package in:
/usr/local/
Step 4 – Set JAVA_HOME and CLASSPATH
You need to point out where you installed Java SDK. You will have to edit the file '.bashrc'. Backup this file first!
In terminal type:
Code: |
|
gedit ~/.bashrc |
Add the following lines to the file:
File:~/.bashrc |
|
#Stuff we added to make tomcat go |
N.B. remember to change the word tomcat to the name of the package you placed in /usr/local.
Save and close. You will have to log out and back in again before these changes take effect.
The next steps are optional. They are for setting tomcat up to be used as a development environment.
Skip to the last step ( Step 8 ) if you just want to start tomcat how it is.
Step 5 – Change default port number
Tomcats default port number is 8080. To change it to 80 or another number do the following.
In terminal type:
Code: |
|
gedit usr/local/tomcat/conf/server.xml |
Find the lines:
Code: |
|
<Connector port="8080" ... maxThreads="150" minSpareThreads="25" ... |
Adjust the port number to 80 (or any other port number you want to use), save and close.
Step 6 – Turn on Servlet reloading
In terminal type:
Code: |
|
gedit usr/local/tomcat/conf/context.xml |
Find:
File:/usr/local/tomcat/conf/context.xml |
|
<Context> |
Change it to:
File:/usr/local/tomcat/conf/context.xml |
|
<Context reloadable="true"> |
Save and close.
Step 7 – Enable Invoker Servlet
In terminal type:
Code: |
|
gedit usr/local/tomcat/conf/web.xml |
Find and uncomment (remove the <-- and --> wrapped around the tags):
File:/usr/local/tomcat/conf/web.xml |
|
<servlet> |
Also find and uncomment:
File:/usr/local/tomcat/conf/web.xml |
|
<servlet-mapping> |
Save and close.
Step 8 – Start tomcat
Tomcat should now be ready to run.
In terminal type:
Code: |
|
sh /usr/local/tomcat/bin/startup.sh |
If everything is working fine, you will see the following lines:
File:/usr/local/tomcat/bin/startup.sh |
|
Using CATALINA_BASE: /usr/local/tomcat |
In your browser head to http://localhost/ and test if it is serving. If you didn't change the port number it was serving on, head to http://localhost:8080/
To stop tomcat type:
Code: |
|
sh /usr/local/tomcat/bin/shutdown.sh |
I hope this helped!
If you have any problems, I recommend this site for more details: http://www.coreservlets.com/
- 16:13
- 浏览 (5434)
- 评论 (3)
- 分类: about CS
- 进入论坛
- 发布在 Ubuntu For Fun 圈子
- 相关推荐
评论
看配置文件也没有错。不知道怎么才能确定服务是否已经正常运行。还有使用了什么端口。
sudo apt-get install sun-java5-jdk
Change the default JDK:
sudo update-alternatives --config java
Install Tomcat:
sudo apt-get install tomcat5
- 浏览: 67763 次

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
From JasperReports To Bi ...
good idea!
-- by iamzmstone -
Installing Tomcat on Ubu ...
装了ubuntu 7.04的tomcat ,但是无法连接啊。 看配置文件也没有错 ...
-- by shaken -
[转贴]Java中四种XML解 ...
呵呵,今后一定改正!谢谢提醒
-- by dodoflying -
[转贴]Java中四种XML解 ...
作为一个技术 blog,为广大开发人员提供知识,这无可厚非。但是请尊重作者劳动成 ...
-- by rosen -
SmartTicket代码阅读笔记 ...
我的邮箱是:dodoflying@gmail.com
-- by dodoflying

Code: 




评论排行榜