Install Java tomcat in Linux

Source: Internet
Author: User
Tags standalone web server
1: Download jdk-1_5_0-linux-i586.bin
2: mkdir/usr/Java
CD/usr/Java
3:./jdk-1_5_0-linux-i586.bin
4: Vim/etc/profile
5: Add:
Export java_home =/usr/Java/jdk1.5.0
Export Path = $ java_home/bin: $ java_home/JRE/bin: $ path
Export tomcat_home =/usr/local/tomcat
Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. jar:
6: restart
7: Java-version

Install Tomcat

1. Download Tomcat

Download the binary version of Tomcat at the address below

Http://mirrors.ccs.neu.edu/Apache/dist/jakarta/tomcat-4/binaries/

Download an object

Tomcat-4.1.18.tar.gz

2. Installation

Extract

Gunzip tomcat-4.1.18.tar.gz
Tar-zxvf tomcat-4.1.18.tar

Get all Tomcat files and copy them to the location you want to install, as shown in figure

/Opt/tomcat-4.1.18/

For convenience, you can change the directory name tomcat-4.1.18 to Tomcat.

3. Set

  • Set route entries

    Add the following two lines to the/etc/profile file:

    Export java_home =/opt/jdk1.4
    Export tomcat_home =/opt/tomcat

    Here we assume that the Java JDK is installed in the/opt/jdk1.4 directory.
     

  • Activate Root

    Root is disabled by default. To activate root, open the file

    Tomcat/CONF/server. xml

    Then

    <! --
    <Context Path = "" docbase = "root" DEBUG = "0"/>
    -->

    Removed, that is, removed <! -- And -->.

  • Activate invoker Servlet

    Remove the comments of the following fields in Tomcat/CONF/Web. xml.

    <Servlet-mapping>
    <Servlet-Name> invoker </servlet-Name>
    <URL-pattern>/servlet/* </url-pattern>
    </Servlet-mapping>
     

  • Set Port
    The default Tomcat port number is 8080. because Tomcat is an independent standalone web server, it can work independently without Apache, so you can not install Apache, so you can set tomcat to port 80. in this way, you can omit: 8080 in the URL. open the tomcat/CONF/Server File. XML, find the following fields:

    <Connector classname = "org. Apache. Coyote. tomcat4.coyoteconnector"
    Port = "8080"...
    .../>

    Then change 8080 to 80.
     

  • Create temp subdirectory
    Create a temp subdirectory under the/opt/tomcat/directory
    Mkdir temp

4. start Tomcat

After the installation, restart the computer to make the settings of java_home and tomcat_home take effect.

/Opt/tomcat/bin

Run the following command:

./Startup. Sh

Normally, the following information is displayed:

Using catalina_base:/opt/tomcat
Using catalina_home:/opt/tomcat
Using catalina_temdir:/opt/tomcat/temp
Using java_home:/opt/jdk1.4

Then open the following webpage in a browser:

Http: // localhost/

Or

Http: // localhost: 8080/(if port number is not changed to 80)

If you see the Tomcat web page (index. jsp), it proves that Tomcat is successfully installed and started.

To disable tomcat, run the following command under/opt/tomcat/bin.

./Shutdown. Sh

5. register your project)

Suppose you have your own JSP project, which should be installed in the following directory:

/Opt/tomcat/webapps/myproject

You must add a line in Tomcat/CONF/server. xml.

<Context Path = "/myproject" docbase = "myproject" DEBUG = "0"/>

The corresponding address in the browser is:

Http: // localhost/myproject

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.