Linux (CentOS) installation Tomcat (installed as service with shell scripts)

Source: Internet
Author: User
Tags glassfish

1. Download Tomcat    Download Linux version (tar.gz) from http://tomcat.apache.org/download-70.cgi link
2, unzip, upload and assign permissionsUnzip, use WINSCP to upload the extracted installation files to the/home/software/tomcat directoryand use chmod-r 755/home/software/tomcat to command account permissions.

3. Write and run the script that is installed as a serviceThe shell script is as follows:     
#! /bin/sh#shell script takes care of starting and stopping# the GlassFish DAS and GlassFish instance.## chkconfig:-64 36# Description:tomcat Auto start#/etc/init.d/tomcatd# Tomcat auto-start# Source function library.#. /etc/init.d/functions# Source Networking configuration.#. /etc/sysconfig/networkretval=0export Jre_home=/usr/local/jdk1.7.0export catalina_home=/home/jinyuan/tomcat/ Tomcatjinyuan1export Catalina_base=/home/jinyuan/tomcat/tomcatjinyuan1start () {if [-F $CATALINA _HOME/BIN/STARTUP.S          h];            Then echo $ "Starting Tomcat" $CATALINA _home/bin/startup.sh retval=$?          echo "OK" return $RETVAL fi}stop () {if [-f $CATALINA _home/bin/shutdown.sh];            Then echo $ "stopping Tomcat" $CATALINA _home/bin/shutdown.sh retval=$? Sleep 1 Ps-fwwu Yhjhoo | grep apache-tomcat|grep-v grep | Grep-v PID |            awk ' {print $} ' |xargs kill-9echo "OK" # [$RETVAL-eq 0] && rm-f/var/lock/... return $RETVAL fi}case "$" in Start) Start;                                                 stop) stop;; Restart) echo $ "restaring Tomcat" $ stop sleep 1 $ start; *) echo $ "Usage: $ Start|stop|restart}" exit 1;; Esacexit $RETVAL
named Tomcatoa (this name is the service name, which is available when the command is started), upload the script file to the/etc/init.d/directory with WINSCPand execute the following script:  sudo chmod +x/etc/init.d/tomcatoa

Chkconfig--add Tomcatoa

Chkconfig Tomcatoa on

4. Start the service tomcatoa the start command with service







      

Linux (CentOS) installation Tomcat (installed as service with shell scripts)

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.