Ubuntu Install Tomcat

Source: Internet
Author: User
Tags wrapper apache tomcat

1, first to ensure that the installation of relevant software

InstallationJAVAEnvironment
Open the terminal, execute the following commands, or use the new software manager, where you can search separately"Sun-java5-jre"and the"SUN-JAVA5-JDK"and mark the installation.
sudo apt-get install Sun-java5-jre
#If the space is rich, it is recommended to install aJDK. Hehe
sudo apt-get install SUN-JAVA5-JDK
Sets the current defaultJavaInterpreter
sudo update-alternatives–config java
After execution, a screen similar to the following will appear:
There is 4 alternatives which provide ' Java '.

Selection Alternative
———————————————–
1/usr/lib/jvm/java-gcj/jre/bin/java
2/usr/bin/gij-wrapper-4.1
3/usr/bin/gij-wrapper-4.0
4/usr/lib/jvm/java-1.5.0-sun/jre/bin/java
Press ENTER to keep the default

or type selection number:

The input has included"Sun"The number in front of the line. As shown above, enter4, and then enter OK.

2, downloadTomcat
$wget http://apache.freelamp.com/jakarta/tomcat-5/v5.5.9/bin/jakarta-tomcat-5.5.9.tar.gz
It's mineTomcatis fromhttp://tomcat.apache.org/download-55.cgihere to downloadCore.Of course, the following file name should be modified accordingly.
3, decompressionTomcat
$sudo Tar zxvf jakarta-tomcat-5.5.9.tar.gz-c/opt
$sudo Mv/opt/jakarta-tomcat-5.5.9/opt/tomcat
4, ensure that the/etc/environmentThe file has: (This step is not very sure whether it is necessary)
>classpath=/usr/lib/j2sdk1.5-sun/lib
>java_home=/usr/lib/j2sdk1.5-sun
5, startTomcat
$sudo/opt/tomcat/bin/startup.sh
If you can see the following hints, it indicates that the boot was successful!
>using catalina_base:/opt/tomcat
>using Catalina_home:/opt/tomcat
>using Catalina_tmpdir:/opt/tomcat/temp
>using Jre_home:/usr/lib/j2sdk1.5-sun
6, test: OpenFirefox, in the Address bar, enterhttp://localhost:8080, if it comes outTomcatthe default interface that explains the test pass!
7, StopTomcatService
$sudo/opt/tomcat/bin/shutdown.sh
8, GetMySQLof theJDBC, inFirefoxenter in the address bar of the browserhttp://dev.mysql.com/get/downloads/connector-j/mysql-connector-java-3.1.10.tar.gz/from/http://mysql.cbn.net.id/to get the software.
9, installationJDBC
$tar-ZXVF mysql-connector-java-3.1.10.tar.gz
$sudo CP Mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin*.jar/usr/lib/j2sdk1.5-sun/lib

ConfigurationTomcatthe Port

UbuntuBring your ownTomcatOpen is the8180ports, which are neither normal nor conducive to use. We can make some simple changes so thatTomcatuse a different port for service. In theTerminal, enter
sudo gedit/usr/share/tomcat5/conf/server.xml

Look in the configuration file
<connector classname= "Org.apache.coyote.tomcat5.CoyoteConnector" port= "8180"

And put one of the8180Replace with the desired port. In general, you can replace theor a8080. If set as the, enter it directly in the browserhttp://localhostyou will be able to accessTomcatthe page. restartTomcateffective.

Set upTomcatAdmin Account

Tomcatuser account information is stored in theTomcat-users.xmlIn the file, run
sudo gedit/usr/share/tomcat5/conf/tomcat-users.xml

In</tomcat-users>add a row before the label
<user username= "User name"password="Password" roles=" Admin,manager "/>

Save and close. Re-runTomcatYou can enter the user name and password, log inTomcatAdministration page.

Install the latest version ofTomcat

We'll introduce you directly fromApache Tomcaton the home page to download and use the latest version5.5.17of theTomcatsoftware, the method is quick and easy and does not affect the stability of the system.

FromTomcatThe official download pagehttp://tomcat.apache.org/download-55.cgi

DownloadBinary->corein the categoryZiportar.gzafter the package, local unzip and rename the newly generated directory toTomcatFor ease of use. Move this folder to a pathpath/. Refer to the above setting environment variables and port settings, and so on! Run directly


Psat the beginning, useApt-getinstallationtomcat5.5,always appears unable to install successfully,in theshutdownwhen,outJavaException,in the end, there's no way.,with
sudo apt-get remove tomcat5.5
Let's get it unloaded..re-download the installation,Don'tApt-get

Ubuntu install tomcat (GO)

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.