技術(shù)員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機純凈版,64位旗艦版,綠色軟件,免費軟件下載基地!

當(dāng)前位置:主頁 > 教程 > 服務(wù)器類 >

Ubuntu 12.04下解決Tomcat自啟動問題

來源:技術(shù)員聯(lián)盟┆發(fā)布時間:2019-01-25 12:07┆點擊:

  當(dāng)我們安裝好Tomcat使用后發(fā)現(xiàn),每次啟動都需要在終端中手動鍵入sudo /var/tomcat/bin/startup.sh,那么我們怎么解決這個問題呢

  以下是我的解決方案:

  1.首先打開終端,輸入su,接著輸入ROOT的密碼獲得ROOT權(quán)限。進入/etc文件夾(使用cd /etc命令)

  2.打開rc.local文件(在/etc目錄下使用vi rc.local命令)

  3.rc.local文件內(nèi)容默認如下

  #!/bin/sh -e

  #

  # rc.local

  #

  # This script is executed at the end of each multiuser runlevel.

  # Make sure that the script will "exit 0" on success or any other

  # value on error.

  #

  # In order to enable or disable this script just change the execution

  # bits.

  #

  # By default this script does nothing.

  /var/tomcat/bin/startup.sh

  exit 0

  4.紅色內(nèi)容為我們手動添加的內(nèi)容,這里指的是tomcat啟動項,那么如何更改呢,首先鍵入A 進入INSERT模式,移動光標(biāo)到紅色位置輸入準(zhǔn)確路徑,按ESC退出INSERT模式,光標(biāo)移動到行尾,鍵入:wq保存文件

  至此,我們已經(jīng)解決這個問題,重啟Ubuntu我們發(fā)現(xiàn)已經(jīng)可以自動訪問Tomcat下的內(nèi)容了