Centos installation tomcat setup boot

Source: Internet
Author: User

Centos installation tomcat setup boot

Install tomcat
Unzip tomcat and you can download the installation package from the official website.

[Root @ template tmp] # wget unzip tmp] # tar-zxvf nginx-1.9.15.tar.gz-C/usr/local/start note here I rename the folder name known as apache-tomcat-7.0.69 tomcat7 [root @ template local] # mv apache-tomcat-7.0.69 tomcat7 [root @ template bin] # cd/usr/local/tomcat7/bin/[root @ template bin] #. /startup. sh close [root @ template bin] #. /shutdown. sh set boot start

Add a script to edit the startup service from oracle installation.

Vim/etc/init. d/tomcat7 # create a new file named tomcat7 by myself #! /Bin/bash # oracle: Start/Stop tomcat7 # chkconfig: 345 90 10 # description: tomcat. JAVA_HOME =/usr/local/jdk1.7.0 _ 79JRE_HOME = $ JAVA_HOME/jre. /etc/rc. d/init. d/functionsLOCKFILE =/var/lock/subsys/tomcat7flagTOMCAT_HOME =/usr/local/tomcat7/TOMCAT_USER = rootcase "$1" in 'start') if [-f $ LOCKFILE]; then echo $0 already running. exit 1 fi echo-n $ "Starting tomcat! "/Usr/local/tomcat7/bin/startup. sh touch $ LOCKFILE; 'stop') if [! -F $ LOCKFILE]; then echo $0 already stopping. exit 1 fi echo-n $ "Stopping tomcat! "/Usr/local/tomcat7/bin/shutdown. sh rm-f $ LOCKFILE; 'restart') $0 stop $0 start; 'status') if [-f $ LOCKFILE]; then echo $0 started. else echo $0 stopped. fi; *) echo "Usage: $0 [start | stop | status]" exit 1 esacexit 0

Modify/etc/init. d/tomcat7 service file permissions [root @ CentOS init. d] # chmod 755/etc/init. d/tomcat7

#chkconfig --add tomcat7

If the script is not written, the solution to service myservice does not support chkconfig may appear.

Add the following two sentences #! /Bin/bash. # Chkconfig: 2345 10 90 # description: myservice ....

Set to boot

If prompted

[root@template sbin]# service tomcat7 stopStopping tomcat!  Neither the JAVA_HOME nor the JRE_HOME environment variable is definedAt least one of these environment variable is needed to run this program

Make the following changes in tomcat:

Vim/usr/local/tomcat7/bin/startup. sh Add the following environment variable export JAVA_HOME =/usr/local/jdk1.7.0 _ 79 export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib/tools. jar: $ JAVA_HOME/lib/dt. jar :. export PATH = $ PATH: $ JAVA_HOME/binexport CATALINA_HOME =/usr/local/tomcat7

[Root @ CentOS ~] # Chkconfig tomcat7 on Test service tomcat7 start/stop/restart

There is also a simple way to directly add the startup command in the startup file to/etc/rc. d/rc. local:/usr/local/tomcat7/bin/startup. sh

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.