Install Tomcat and set the JSP environment in Linux

Source: Internet
Author: User
Tags apache tomcat
Install Tomcat

Tomcat is a network service software developed by Apache Foundation to support JSP (Java Server Page. The tomcat version in the Ubuntu software library is outdated, but the installation is relatively convenient:

 
Sudo apt-Get install tomcat5

Wait a moment, Tomcat will be automatically installed in the/usr/share/tomcat5 directory.

[Edit] Set the Java environment for Tomcat running

First, make sure that Sun's Java Development Toolkit has been installed. If not, you can use apt-Get.

 
Sudo apt-Get install sun-java6-jdk

After Java is installed, modify the environment variables of the system. Tomcat can run normally only after the java_home or jre_home environment variables are set. Open the configuration file:

 
Sudo gedit ~ /. Bashrc

(If the kubuntu user does not install gedit, replace gedit with your frequently-used text editor)

Add the following two lines at the end of the file:

Export java_home =/usr/lib/JVM/Java-6-sun-1.6.0.15
Export Path = $ path: $ java_home/bin

Log out and log on again. The new environment variable takes effect.

[Edit] Start and Stop Tomcat

To start Tomcat, run

 
Sudo/usr/share/tomcat5/bin/./startup. Sh

Open your browser and enter http: // localhost: 8180 in the address bar (note! Tomcat 8180 In the Ubuntu software library uses port 8080 by default, instead of in the later version. Installed successfully!

To stop tomcat, run

 
Sudo/usr/share/tomcat5/bin/./shutdown. Sh

[Edit] Configure Tomcat Port

Ubuntu Tomcat opens port 8180, which is neither regular nor conducive to use. We can make some simple modifications so that Tomcat can use other ports for service. In terminal, enter

Sudo gedit/usr/share/tomcat5/CONF/server. xml

Search in the configuration file

 
<Connector classname = "org. Apache. Coyote. tomcat5.coyoteconnector" Port = "8180"

Replace 8180 with the required port. Generally, it can be replaced with 80 or 8080. If it is set to 80, enter http: // localhost in the browser to access the Tomcat page. Restart tomcat to take effect.

[Edit] Set the Tomcat Administrator Account

Tomcat user account information is saved in the tomcat-users.xml file, run

 
Sudo gedit/usr/share/tomcat5/CONF/tomcat-users.xml

Add a line before the </tomcat-users> label

 
<User Username = "username" Password = "password" roles = "Admin, Manager"/>

Save and close. Run Tomcat again and enter the user name and password to log on to the Tomcat Management page.

[Edit] Install the latest version of Tomcat

Next we will introduce how to download and use the latest version of Tomcat software 5.5.17 from the Apache Tomcat home page. This method is convenient and quick and does not affect the system stability.

Download from the official Tomcat page

 
Http://tomcat.apache.org/download-55.cgi

Download the zipw.tar.gz package in binary-> corecategory, decompress it locally, and rename the newly generated directory to Tomcat for ease of use. Move this folder to a path /. Please refer to the preceding steps to set environment variables and ports! Run directly

 
Path/tomcat/bin/./startup. Sh

Tomcat5.5.17 is now available in the background. (Replace path with the appropriate path)

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.