Under Linux (CentOS), download and install Tomcat and configure __linux

Source: Internet
Author: User

1, download and decompression

From the official website (http://tomcat.apache.org/), select the appropriate version and download (My choice is: apache-tomcat-8.0.9.tar.gz).

# mkdir tomcat-src && cd tomcat-src
# wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.17/bin/ apache-tomcat-8.0.17.tar.gz
# tar Xzf apache-tomcat-8.0.17.tar.gz

2. Start or close

Enter Tomcat's Bin directory and use the scripting commands it provides (startup.sh/shutdown.sh) to start or close.
Once started, you can use the browser to open the page (http://host:8080), which is successful if the default page for Tomcat appears.

3, add system services

Using the command "# Vi/etc/init.d/tomcat", open the editor and enter the following:

#!/bin/bash #
chkconfig:2345
# vi/etc/init.d/tomcat #
init script for Tomcat precesses
# gaojs@hz. CN

tomcat_home= "/home/tomcat-8.0.17" Case

"in Start"
        if [-f $TOMCAT _home/bin/startup.sh];
          Then
            echo $ "Starting Tomcat"
            su-root-c "$TOMCAT _home/bin/startup.sh"
        fi
        ;
Stop)
        if [-f $TOMCAT _home/bin/shutdown.sh];
          Then
            echo $ "stopping Tomcat"
            su-root-c "$TOMCAT _home/bin/shutdown.sh"
        fi
        ;
*)
        echo $ "Usage: $ {start|stop}"
        exit 1
        ;;
Esac

Exit 0
After you save the exit, use the following command to make it executable, and then add the configuration and view it.
You can modify its value using Chkconfig, or you can use the NTSYSV tool to change whether it starts.
# chmod +x/etc/init.d/tomcat
# chkconfig--add Tomcat
# chkconfig Tomcat on/off  
# chkconfig--list tomcat< C29/>tomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off

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.