Install Tomcat 6 in Linux

Source: Internet
Author: User
Tags apache tomcat

Install Tomcat 6.
 Copy the tomcat installation package to/usr.

 CP apache-tomcat-6.0.14.tar/usr/
CD/usr
Mkdir tomcat6
Tar-zvxf apache-tomcat-6.0.14.tar
  After decompression, you can start it.
 CD/usr/tomcat6/bin
Sh startup. Sh
Test
Http: // 127.0.0.1: 8080
Success if a kitten appears
Attach to system startup
# Vi/etc/rc. d/rc. Local
#/Usr/local/tomcat/bin/startup. Sh (add to the end of the file) Tomcat can be started with jsvc ):

Jsvc was supposed to download from the http://jakarta.apache.org, but tomcat6 has brought a, in Apache-Tomcat-6.0.13/bindirectory has a jsvc.tar.gz package, decompress, compile:

# Tar-xzvf jsvc.tar.gz
# Cd jsvc-Src
# Sh support/buildconf. Sh
#./Configure -- With-Java =/usr/Java
# Make

View the two scripts tomcat in the/usr/local/Apache-Tomcat-6.0.13/bin/jsvc-src/native directory. SH and tomcat5.sh are used as scripts for starting and stopping Tomcat before and after tomcat5.
Because the configurations of each machine are different, you need to modify the startup script parameters.

The following uses tomcat6 as an example. Therefore, modify tomcat5.sh. The modified file is as follows:

#! /Bin/sh
######################################## ######################################
#
#Copyright 2004 the Apache Software Foundation.
#
#Licensed under the Apache license, version 2.0 (the "License ");
#You may not use this file before t in compliance with the license.
#You may obtain a copy of the license
#
#    Http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#Distributed under the license is distributed on an "as is" basis,
#Without warranties or conditions of any kind, either express or implied.
#See the license for the specific language governing permissions and
#Limitations under the license.
######################################## ######################################
#
# Chkconfig: 2345 85 15
# Description: apache-tomcat.6

#
# Small shell script to show how to start/stop Tomcat using jsvc
# If you want to have Tomcat running on port 80 Please modify the server. xml
# File:
#
#  <! -- Define a non-ssl http/1.1 Connector on port 80 -->
#  <Connector classname = "org. Apache. Catalina. connector. http. httpconnector"
#            Port = "80" minprocessors = "5" maxprocessors = "75"
#            Enablelookups = "true" redirectport = "8443"
#            Acceptcount = "10" DEBUG = "0" connectiontimeout = "60000"/>
#
# That is for Tomcat-5.0.x (Apache Tomcat/5.0)
#
# Adapt the following lines to your configuration
Java_home =/usr/Java/jdk1.6.0 _ 01
Catalina_home =/usr/local/Apache-Tomcat-6.0.13
Daemon_home =/usr/local/Apache-Tomcat-6.0.13/bin
Tomcat_user = Tomcat

# For multi instances adapt those lines.
Tmp_dir =/var/tmp
Pid_file =/var/run/jsvc. PID
Catalina_base =/usr/local/Apache-Tomcat-6.0.13
# Catalina_opts = "-djava. Library. Path =/home/jfclere/Jakarta-Tomcat-connectors/JNI/native/. Libs"
Catalina_opts =

Classpath = \
$ Java_home/lib/tools. jar :\
$ Catalina_home/bin/commons-daemon.jar :\
$ Catalina_home/bin/Bootstrap. Jar
Case "$1" in
Start)
  #
  # Start Tomcat
  #
  $ Daemon_home/jsvc-src/jsvc \
  -User $ tomcat_user \
  -Home $ java_home \
  -Dcatalina. Home = $ catalina_home \
  -Dcatalina. base = $ catalina_base \
  -Djava. Io. tmpdir = $ tmp_dir \
  -Wait 10 \
  -Pidfile $ pid_file \
  -OUTFILE $ catalina_home/logs/Catalina. Out \
  -Errfile '& 1 '\
  $ Catalina_opts \
  -CP $ classpath \
  Org. Apache. Catalina. startup. Bootstrap
  #
  # To get a verbose JVM
  #-Verbose \
  # To get a debug of jsvc.
  #-Debug \
  Exit $?
  ;;
Stop)
  #
  # Stop Tomcat
  #
  $ Daemon_home/jsvc-src/jsvc \
  -Stop \
  -Pidfile $ pid_file \
  Org. Apache. Catalina. startup. Bootstrap
  Exit $?
  ;;
*)
  Echo "usage tomcat. Sh start/stop"
  Exit 1 ;;
Esac

After the modification, copy tomcat5.sh to the/etc/rc. d/init. d/directory and name it tomcat.
# Cp/usr/local/Apache-Tomcat-6.0.13/bin/jsvc-src/native/tomcat5.sh/etc/rc. d/init. d/tomcat

Add to System Service
# Chkconfig -- add Tomcat
Use -- list to check whether the system has a tomcat Startup File.
# Ckhconfig -- list
Tomcat is automatically started with the system. This script will be automatically started in runlevel 2/3/4/5 mode.

The system service script must have the following two lines
# Chkconfig: 2345 85 15

(Note: add the service in runtime Level 2/3/4/5. The start sequence is 85 and the Stop sequence is 15)
# Description: apache-tomcat.6

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.