Detailed installation and configuration of Tomcat for Linux

Source: Internet
Author: User
Tags wrapper

1. To the official website http://jakarta.apache.org/Tomcat Download the apache-tomcat-7.0.2.tar.gz installation file, the JDK assumes that the installation is complete, then install directly Tomcat.
2. Installation
# TAR-ZXVF apache-tomcat-7.0.2.tar.gz
# LS//will be found in the current directory, more than one folder
apache-tomcat-7.0.2 apache-tomcat-7.0.2.tar.gz
# mv apache-tomcat-7.0.2/usr/local/tomcat-7.0.2
# mv apache-tomcat-7.0.2/usr/local/tomcat-7.0.2
3. Setting Environment variables
# VI ~/.BASHRC

if [-F/ETC/BASHRC]; Then
. /etc/bashrc
Fi
Add the following two items and then save the exit: Wq Enter
Export catalina_base=/usr/local/tomcat-7.0.2
Export catalina_home=/usr/local/tomcat-7.0.2

4. Verify that the installation is successful
# echo $CATALINA _home
/usr/local/tomcat-7.0.2
# echo $CATALINA _base
/usr/local/tomcat-7.0.2

If the above content is displayed, OK, it is already in effect. If it is not displayed, reboot the system and try again.

4. Start the service
Let's take a look at the ports that Linux opens:
# netstat–l

# Cd/usr/local/tomcat-7.0.2/bin
# ls
Bootstrap.jar setclasspath.sh
Catalina.50.bat Shutdown.bat
catalina.50.sh shutdown.sh
Catalina.bat shutdown-using-launcher.bat
catalina.sh shutdown-using-launcher.sh
Catalina.xml startup.bat
Commons-daemon.jar startup.sh
Commons-launcher.jar Startup-using-launcher.bat
Commons-logging-api.jar startup-using-launcher.sh
cpappend.bat  tomcat5.exe
Digest.bat tomcat5w.exe
digest.sh Tool-wrapper.bat
Jmx.jar tool-wrapper.sh
jsvc.tar.gz tool-wrapper-using-launcher.bat
Launcherbootstrap.class tool-wrapper-using-launcher.sh
launcher.properties version.bat
Service.bat version.sh
Setclasspath.bat
//We need to note this file: startup.sh

#./startup.sh
Using catalina_base:/usr/local/jakarta-tomcat-5.0.28
Using catalina_home:/usr/local/jakarta-tomcat-5.0.28
Using catalina_tmpdir:/usr/local/jakarta-tomcat-5.0.28/temp
Using Java_home:/usr/java/j2sdk1.4.2_04
We're just going to have a look at the ports that Linux now opens:
# netstat–l

is not more than a 8080 port it! This is the default port for Tomcat/
Okay, let's start our installation test.

http://localhost:8080
Did you see the Tomcat Web page?

If you haven't seen it yet, turn off the fire wall.
# Service Iptables Stop
Purge firewall rules: [OK]
Set chains to ACCEPT policy: filter [OK]
Uninstalling Iiptables module: [OK],

All right. It's definitely no problem this time.

5.Tomcat boot auto-load
# vi/etc/rc.d/rc.local
Displays the following content

#!/bin/sh
#
# This script is executed *after* all and the other init scripts.
# can put your own initialization stuff in here if you don ' t
# want to does the full Sys V style init stuff.

Touch/var/lock/subsys/local

Add the following sentence
/usr/local/tomcat-7.0.2/bin/startup.sh

This will automatically start Tomcat after the system restarts (be sure that the JDK is installed and usable, otherwise it won't work well)

6. Close the service
# cd/usr/local/Tomcat-7.0.2/bin
#./shutdown.sh
Using catalina_base:/usr/local/tomcat-7.0.2
Using catalina_home:/usr/local/tomcat-7.0.2
Using catalina_tmpdir:/usr/local/tomcat-7.0.2/temp
Using jre_home:/usr
Using CLASSPATH:/usr/local/tomcat-7.0.2/bin/bootstrap.jar:/usr/local/tomcat-7.0.2/bin/ Tomcat-juli.jar

7. Testing of independent environments

(1) test the health of Java, such as the following command:
Java-version
Javac-version
Seeing the version number indicates that the JDK installation was successful

(2) test Apache's health, such as the following command:
/ETC/RC.D/INIT.D/HTTPD Restart # # restart Apache Server
Use any browser, enter the server address and return, you should see the default home page of Apache

(3) test the health of jakarta-Tomcat, as in the following command:
Enter the bin directory below the Tomcat installation directory
./startup.sh # # Start jakarta-tomcat-4.1.24 Service
Use any browser, enter the server address and port number 8080 and return, you should seethe default home page of jakarta-tomcat-4.1.24
Example: http://localhost:8080
./shutdown.sh # # Close jakarta-tomcat-4.1.24 service

8. After installing Tomcat under Linux , what is the user name and password when it is opened?

In the/usr/local/tomcat-7.0.2/conf/tomcat-users.xml file. To edit this file, you can modify the user name and password, for example:

<role name= "Manager-gui"/>
<user name= "root" password= "admin" roles= "Manager-gui"/>?
<role rolename= "Admin-gui"/>
<user username= "admin" password= "admin" roles= "Admin-gui"/>

User root is managed by: status and Tomcat Manager.
User admin is managed by: Host Manager.
Restart Tomcat after saving .

Detailed installation and configuration of Tomcat for Linux

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.