Ubuntu11.10 install Tomcat 6 and tomcat 7

Source: Internet
Author: User
1. First, make sure that you have installed jdk and set the JAVA_HOME environment variable. Then 1. First, make sure that you have installedJdk With settingsJAVA _HOME Environment variable.
ThenHttp://tomcat.apache.org/ DownloadApache-tomcat-6.0.35.tar.gz, I move it/Usr/local/webserver/ Then Enter Run

Code:

[Plain]
  1. 1. sudo tar apache-tomcat-6.0.35.tar.gz zxvf

Get a folderApache -- tomcat-6.0.35,At this time,TomcatThe installation is complete.


2. Then SetJAVA_HOME Environment variables. The solutions are listed below.
Run Code :

[Plain]
  1. 1. sudo vi/usr/local/webserver/apache-tomcat-6.0.35/bin/catalina. sh

ModifyCatalina. shFile, which is inserted after being commented at the beginning of the file

Reference:

[Plain]
  1. 1. JAVA_HOME = "/usr/lib/jvm/java/jdk1.6.0 _ 30"


Note: The above path is the jdk path you have installed.

3. Then execute Code :

[Plain]
  1. 1. sudo/usr/local/webserver/apache-tomcat-6.0.35/bin/startup. sh

In this way, the instance can be started successfully.Tomcat.

4. Haha, add the last step: easily start, close, and restartTomcat
InSudoVi~ /. Bashrc File:

Reference:

[Plain]
  1. 1. alias starttomcat = 'sudo/usr/local/webserver/apache-tomcat-6.0.35/bin/startup. Sh'
  2. 1. alias shutdowntomcat = 'sudo/usr/local/webserver/apache-tomcat-6.0.35/bin/shutdown. Sh'
  3. 1. alias restarttomcat = 'shutdowntomcat & starttomcat'

Then execute

Code:

[Plain]
  1. 1. source ~ /. Bashrc

Then you can use:

Starttomcat: Enable tomcat

Shutdowntomcat: Disable tomcat

Restarttomcat: restart tomcat


5. You can modify the server. xml file to omit the Port during access. For example, the default port of tomcat-6.0.35 is 8080. to change it to 80, perform the following operations:

Code

[Plain]
  1. 1. sudo vi/usr/local/webserver/apache-tomcat-6.0.35/conf/server. xml

Modify server. xml, change all the numbers to 80, and change the Port location

Reference

Port 80 is special. If you change the port to 80, you can directly enter http: // localhost/in the address bar to access your web

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.