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