1. 程式人生 > >Linux:Tomcat配置及設置開機自啟動

Linux:Tomcat配置及設置開機自啟動

down %20 fig 選項 輸入 html download c-c erl

1、配置完成後 2、執行:source /etc/profile 3、啟動Tomcat服務器,tomcat對應的bin下面執行:./startup.sh(啟動/關閉命令:http://www.cnblogs.com/tovep/articles/2473147.html) 4、在瀏覽器中輸入:http://服務器IP:8080。正確打開則表明tomcat啟動成功 5、設置Tomcat開機自啟項 6、編寫開機自啟項腳本,該腳本以UTF-8保存,保存為tomcat文件: #!/bin/sh # tomcat: Start/Stop/Restart tomcat # chkconfig: 2345 40 20 # description: Tomcat is a Java Servlet Container # match these values to your environment: export CATALINA_BASE=/opt/apache-tomcat-7.0.77 export CATALINA_HOME=$CATALINA_BASE export CATALINA_TMPDIR=$CATALINA_BASE/temp export JRE_HOME=/opt/jdk1.8.0_131 # Source function library. start() { echo -n "Starting Tomcat: " $CATALINA_BASE/bin/startup.sh start } stop() { echo -n "Stopping Tomcat: " $CATALINA_BASE/bin/shutdown.sh stop } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop sleep 2 start ;; *) echo "Usage: $0 {start stop restart}" ;; esac exit $RETVAL 7、將該文件通過WinSCP放到服務器的/tmp文件中 8、通過命令:mv /tmp/tomcat /etc/init.d/ 將tomcat文件移到init.d文件中 9、tomcat/bin 目錄下,通過命令:chmod a+x /etc/init.d/tomcat 給所有人提供執行tomcat的權限 10、tomcat/bin 目錄下, 通過命令:chown root:root /etc/init.d/tomcat 切換tomcat對應的用戶 11、tomcat/bin 目錄下, 執行命令:sysv-rc-conf 若沒有安裝,根據提示安裝 若已安裝,則操作tomcat對應的選項 技術分享
12、編輯完成後,按q退出該頁面

Linux:Tomcat配置及設置開機自啟動