Chinaunix首页 | 论坛 | 博客
  • 博客访问: 234696
  • 博文数量: 41
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 441
  • 用 户 组: 普通用户
  • 注册时间: 2015-04-11 11:05
个人简介

123

文章分类

全部博文(41)

文章存档

2019年(2)

2018年(3)

2017年(2)

2016年(11)

2015年(23)

我的朋友

分类: LINUX

2015-05-16 15:45:02

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 ~]$
好,启动成功!
在网页浏览器中输入看服务是否运行可以访问:

关闭tomcat:
[user@localhost ~]$ sudo /etc/rc.d/init.d/tomcat stop
Stopping tomcat:                                           [  确定  ]
[user@localhost ~]$
至此,安装、启动和关闭都顺利完成。

阅读(2378) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~