个人工具

“UbuntuHelp:ApacheTomcat5”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(New page: {{From|https://help.ubuntu.com/community/ApacheTomcat5}} {{Languages|php5}} This is to help people setup and install Apache Tomcat 5. === Apache Tomcat 5 === Jakarta Tomcat, a Java ser...)
 
第24行: 第24行:
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install sun-java5-jdk
 
sudo apt-get install sun-java5-jdk
</nowiki></code>
+
</nowiki></pre>
  
 
'''Set Java environment variables'''
 
'''Set Java environment variables'''
第30行: 第30行:
 
$ export JAVA_HOME="path of your java home"
 
$ export JAVA_HOME="path of your java home"
 
$ export PATH=$PATH:$JAVA_HOME/bin
 
$ export PATH=$PATH:$JAVA_HOME/bin
</nowiki></code>
+
</nowiki></pre>
  
 
In Ubuntu 6.06,do:
 
In Ubuntu 6.06,do:
 
<pre><nowiki>
 
<pre><nowiki>
 
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.06
 
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.06
</nowiki></code>
+
</nowiki></pre>
  
 
You may have to change the numbers for updated versions.
 
You may have to change the numbers for updated versions.
第43行: 第43行:
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo aptitude install tomcat5 tomcat5-admin tomcat5-webapps
 
$ sudo aptitude install tomcat5 tomcat5-admin tomcat5-webapps
</nowiki></code>
+
</nowiki></pre>
  
 
==== Run, Stop, And Restart Apache Tomcat ====
 
==== Run, Stop, And Restart Apache Tomcat ====
第49行: 第49行:
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo /etc/init.d/tomcat5 start
 
$ sudo /etc/init.d/tomcat5 start
</nowiki></code>
+
</nowiki></pre>
 
To stop it, use :
 
To stop it, use :
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo /etc/init.d/tomcat5 stop
 
$ sudo /etc/init.d/tomcat5 stop
</nowiki></code>
+
</nowiki></pre>
 
Finally, to restart it, run :
 
Finally, to restart it, run :
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo /etc/init.d/tomcat5 restart
 
$ sudo /etc/init.d/tomcat5 restart
</nowiki></code>
+
</nowiki></pre>
  
 
==== Using Tomcat5 ====
 
==== Using Tomcat5 ====
 
You can find tomcat up and running (if you have followed the previous steps) at the following ip:
 
You can find tomcat up and running (if you have followed the previous steps) at the following ip:
 
<pre><nowiki> 127.0.0.1:8180
 
<pre><nowiki> 127.0.0.1:8180
</nowiki></code>
+
</nowiki></pre>
  
 
==== Administering Tomcat5 ====
 
==== Administering Tomcat5 ====
第68行: 第68行:
 
<pre><nowiki>
 
<pre><nowiki>
 
$ /usr/share/tomcat5/conf/tomcat-users.xml
 
$ /usr/share/tomcat5/conf/tomcat-users.xml
</nowiki></code>
+
</nowiki></pre>
  
 
and add the following lines for creating new users with admin and manager privilegies as described in Tomcat's main page
 
and add the following lines for creating new users with admin and manager privilegies as described in Tomcat's main page
第76行: 第76行:
 
   <role rolename="admin"/>
 
   <role rolename="admin"/>
 
<user username="YOUR USERNAME " password="YOUR PASSWORD" roles="admin,manager"/>
 
<user username="YOUR USERNAME " password="YOUR PASSWORD" roles="admin,manager"/>
</nowiki></code>
+
</nowiki></pre>
 
Obviously if you want only one kind of role you've to delete the one you are not interested in. Example only admin
 
Obviously if you want only one kind of role you've to delete the one you are not interested in. Example only admin
 
<pre><nowiki>  
 
<pre><nowiki>  
 
   <role rolename="admin"/>
 
   <role rolename="admin"/>
 
<user username="YOUR USERNAME " password="YOUR PASSWORD" roles="admin"/>
 
<user username="YOUR USERNAME " password="YOUR PASSWORD" roles="admin"/>
</nowiki></code>
+
</nowiki></pre>
 
==== Installing new servlet or jsp pages in Tomcat5 ====
 
==== Installing new servlet or jsp pages in Tomcat5 ====
 
Using the Tomcat manager included in the installed packages you'll be able to to control your servlet/jsp properly.
 
Using the Tomcat manager included in the installed packages you'll be able to to control your servlet/jsp properly.
第93行: 第93行:
 
<pre><nowiki>  
 
<pre><nowiki>  
 
   file://YOUR SERVLET or JSP PAGE DIRECTORY
 
   file://YOUR SERVLET or JSP PAGE DIRECTORY
</nowiki></code>
+
</nowiki></pre>
 
Usually servlet/jsp pages are located in the directory ''/usr/share/tomcat5/webapps''.
 
Usually servlet/jsp pages are located in the directory ''/usr/share/tomcat5/webapps''.
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年5月13日 (日) 12:33的版本


This is to help people setup and install Apache Tomcat 5.


Apache Tomcat 5

Jakarta Tomcat, a Java servlet container is now part of the Apache family under the name of Apache Tomcat. It can be installed in Ubuntu 6.06 (Dapper Drake) following the steps below.

Needed before installing Apache Tomcat

Java virtual machine Follow this link paying attention to download the JDK and not the JRE.


Enable the universe and multiverse repositories


In Ubuntu 6.06, do:

sudo apt-get install sun-java5-jdk

Set Java environment variables

$ export JAVA_HOME="path of your java home"
$ export PATH=$PATH:$JAVA_HOME/bin

In Ubuntu 6.06,do:

export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.06

You may have to change the numbers for updated versions.

Installing Apache Tomcat 5

$ sudo aptitude install tomcat5 tomcat5-admin tomcat5-webapps

Run, Stop, And Restart Apache Tomcat

Use the following command to run Apache Tomcat:

$ sudo /etc/init.d/tomcat5 start

To stop it, use :

$ sudo /etc/init.d/tomcat5 stop

Finally, to restart it, run :

$ sudo /etc/init.d/tomcat5 restart

Using Tomcat5

You can find tomcat up and running (if you have followed the previous steps) at the following ip:

 127.0.0.1:8180

Administering Tomcat5

If you have installed also the admin package as listed before you will be able to enter in the administation window only if you edit the file

$ /usr/share/tomcat5/conf/tomcat-users.xml

and add the following lines for creating new users with admin and manager privilegies as described in Tomcat's main page

 
  <role rolename="manager"/>
  <role rolename="admin"/>
<user username="YOUR USERNAME " password="YOUR PASSWORD" roles="admin,manager"/>

Obviously if you want only one kind of role you've to delete the one you are not interested in. Example only admin

 
   <role rolename="admin"/>
<user username="YOUR USERNAME " password="YOUR PASSWORD" roles="admin"/>

Installing new servlet or jsp pages in Tomcat5

Using the Tomcat manager included in the installed packages you'll be able to to control your servlet/jsp properly.

1.Enter in your server (by default 127.0.0.1:8180).

2.Enter in the Tomcat manager page (you find the link on the left) typing username and password chosen in the previous step.

3.Search the section Deploy and in the field WAR or Directory URL type:

 
   file://YOUR SERVLET or JSP PAGE DIRECTORY

Usually servlet/jsp pages are located in the directory /usr/share/tomcat5/webapps.