linux中怎么关闭tomcat服务器,linux系统安装、启动和关闭tomcat

Tomcat 可充当一个完全独立的 web 服务器。Tomcat 最大优势在于 servlet 和 JSP 引擎。

安装 tomcat:

Sudo yum install -y tomcat-*

启动 tomcat:

[user@localhost ~]$ /etc/rc.d/init.d/tomcat start

[user@localhost ~]$

[user@localhost ~]$ /etc/rc.d/init.d/tomcat status

[user@localhost ~]$

如上所示,启动过程没有任何输出,查看服务状态也没有任何输出,说明服务启动没有成功。

为何呢?

想到/etc/rc.d/init.d/tomcat 是 bash 脚本,因此可以对其进行调试,调试方法如下:

[user@localhost ~]$ bash -x /etc/rc.d/init.d/tomcat status

+ '[' -r /lib/lsb/init-functions ']'

+ exit 1

[user@localhost ~]$

由以上输出可以,问题出在 /lib/lsb/init-functions 文件找不到。好,下面查查该文件属于哪个 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

正在解决依赖关系

--> 正在检查事务

---> 软件包 redhat-lsb-core.x86_64.0.4.1-15.1.fc19 将被 安装

--> 解决依赖关系完成

依赖关系解决

========================================================================

===================================================================

Package

架构

版本

大小

========================================================================

===================================================================

正在安装:

redhat-lsb-core

x86_64

4.1-15.1.fc19

updates

36 k

事务概要

========================================================================

===================================================================

安装 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

验 证 中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

再次启动 tomcat 试试。

[user@localhost ~]$ sudo /etc/rc.d/init.d/tomcat start

Starting tomcat:[ 确定 ]

[user@localhost ~]$

好,启动成功!

在网页浏览器中输入http://127.0.0.1:8080/看服务是否运行可以访问:

关闭tomcat:

[user@localhost ~]$ sudo /etc/rc.d/init.d/tomcat stop

Stopping tomcat:                                           [  确定  ]

[user@localhost ~]$

至此,安装、启动和关闭都顺利完成。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值