linux 开启关闭tomcat服务器端口,linux系统安装、启动和关闭tomcat
Tomcat 可充當(dāng)一個(gè)完全獨(dú)立的 web 服務(wù)器。Tomcat 最大優(yōu)勢在于 servlet 和 JSP 引擎。
安裝 tomcat:
Sudo yum install -y tomcat-*
啟動(dòng) tomcat:
[user@localhost ~]$ /etc/rc.d/init.d/tomcat start
[user@localhost ~]$
[user@localhost ~]$ /etc/rc.d/init.d/tomcat status
[user@localhost ~]$
如上所示,啟動(dòng)過程沒有任何輸出,查看服務(wù)狀態(tài)也沒有任何輸出,說明服務(wù)啟動(dòng)沒有成功。
為何呢?
想到/etc/rc.d/init.d/tomcat 是 bash 腳本,因此可以對(duì)其進(jìn)行調(diào)試,調(diào)試方法如下:
[user@localhost ~]$ bash -x /etc/rc.d/init.d/tomcat status
+ '[' -r /lib/lsb/init-functions ']'
+ exit 1
[user@localhost ~]$
由以上輸出可以,問題出在 /lib/lsb/init-functions 文件找不到。好,下面查查該文件屬于哪個(gè) rpm
包。
[user@localhost ~]$ yum whatprovides /lib/lsb/init-functions
已加載插件:langpacks, refresh-packagekit
redhat-lsb-core-4.1-14.fc19.i686 : LSB Core module support
源
:fedora
匹配來源:
文件名
:/lib/lsb/init-functions
redhat-lsb-core-4.1-14.fc19.x86_64 :源
:fedora
匹配來源:
文件名
:/lib/lsb/init-functions
LSB Core module support
redhat-lsb-core-4.1-15.1.fc19.i686 : LSB Core module support
源
:updates
匹配來源:
文件名
:/lib/lsb/init-functions
redhat-lsb-core-4.1-15.1.fc19.x86_64 : LSB Core module support
源
:updates
匹配來源:
文件名
:/lib/lsb/init-functions
哦,原來 tomcat 依賴于包 redhat-lsb-core,但在 tomcat 的 requires 中沒有寫明,坑啊!
下面,把 redhat-lsb-core 裝上看看。
[user@localhost ~]$ sudo yum install -y redhat-lsb-core
已加載插件:langpacks, refresh-packagekit
正在解決依賴關(guān)系
--> 正在檢查事務(wù)
---> 軟件包 redhat-lsb-core.x86_64.0.4.1-15.1.fc19 將被 安裝
--> 解決依賴關(guān)系完成
依賴關(guān)系解決
========================================================================
===================================================================
Package
架構(gòu)
版本
源
大小
========================================================================
===================================================================
正在安裝:
redhat-lsb-core
x86_64
4.1-15.1.fc19
updates
36 k
事務(wù)概要
========================================================================
===================================================================
安裝 1 軟件包
總下載量:36 k
安裝大小:45 k
Downloading packages:
redhat-lsb-core-4.1-15.1.fc19.x86_64.rpm
| 36 kB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正 在 安 裝1/1
驗(yàn) 證 中1/1
已安裝:
redhat-lsb-core.x86_64完畢!
0:4.1-15.1.fc19
redhat-lsb-core-4.1-15.1.fc19.x86_64
redhat-lsb-core-4.1-15.1.fc19.x86_64
再次啟動(dòng) tomcat 試試。
[user@localhost ~]$ sudo /etc/rc.d/init.d/tomcat start
Starting tomcat:[ 確定 ]
[user@localhost ~]$
好,啟動(dòng)成功!
在網(wǎng)頁瀏覽器中輸入http://127.0.0.1:8080/看服務(wù)是否運(yùn)行可以訪問:
關(guān)閉tomcat:
[user@localhost ~]$ sudo /etc/rc.d/init.d/tomcat stop
Stopping tomcat:?????????????????????????????????????????? [? 確定? ]
[user@localhost ~]$
至此,安裝、啟動(dòng)和關(guān)閉都順利完成。
總結(jié)
以上是生活随笔為你收集整理的linux 开启关闭tomcat服务器端口,linux系统安装、启动和关闭tomcat的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 奥鹏17计算机应用基础离线,奥鹏《计算机
- 下一篇: linux讲日志暂停,linux – R