lunux 启动 tomcat
本人从官网http://tomcat.apache.org/上面下载的6.0.1_31版本,并解压包后改名存放在:/usr/share/tomcat6
本人使用的是root用户登录,下面就说说具体的操作步骤,
1、在/usr/share/tomcat6/bin中有commons-daemon-native.tar.gz 压缩包
2、解压commons-daemon-native.tar.gz
[root@localhost ~]# tar -zxvf commons-daemon-native.tar.gz
3、解压完成,出现commons-daemon-1.0.2-native-src文件夹(目录)
1、 进入commons-daemon-1.0.2-native-src 下的unix目录
[root@localhost ~]# ls
[root@localhost ~]# cdcommons-daemon-1.0.2-native-src/unix
2、 发现configure 配置文件,执行如下修改属性的命令
[root@localhost ~]# chmod 777 configure
4、 执行configure 文件
[root@localhost ~]# ./configure
5、 编译
[root@localhost ~]# make #会报错
[root@localhost ~]# make clean
[root@localhost ~]# make #重新编译成功
6、 编译完成后出现jsvc文件夹,复制jsvc到/usr/share/tomcat6/bin目录下面
[root@localhost ~]# cp jsvc /usr/share/tomcat6/bin
------------------------------------------------------------------------------------
10、在/etc/init.d/目录下编写tomcat6启动服务配置文件。
[root@localhost ~]#cd /etc/init.d/
[root@localhost ~]# vi tomcat6
录入以下内容
#!/bin/sh
# tomcat: Start/Stop/Restart tomcat
#
# chkconfig: 2345 85 15
# description: Apache tomcat6
# Small shell script to show how to start/stop Tomcat using jsvc
# If you want to have Tomcat running on port 80 please modify the server.xml
# file:
#
# <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
# <Connector className="org.apache.catalina.connector.http.HttpConnector"
# port="80" minProcessors="5" maxProcessors="75"
# enableLookups="true" redirectPort="8443"
# acceptCount="10" debug="0" connectionTimeout="60000"/>
#
JAVA_HOME=/usr/java/jdk1.6.0_31 #根据自己的实际jdk位置来修改
CATALINA_HOME=/usr/share/tomcat6 #根据自己实际tomcat位置来修改
DAEMON_HOME=$CATALINA_HOME/bin
# I did not use the user.
#TOMCAT_USER=tomcat
# for multi instances adapt those lines.
TMP_DIR=$CATALINA_HOME/tmp
PID_FILE=/var/run/jsvc.pid
CATALINA_BASE=$CATALINA_HOME
. /etc/rc.d/init.d/functions
CATALINA_OPTS=
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar
start() {
echo -n $"Starting Tomcat6: "
# If you want to specify a user to run Tomcat.
#increase the 'user $ TOMCAT_USER \' to the parameter list.
$DAEMON_HOME/jsvc \
-home $JAVA_HOME \
-Dcatalina.home=$CATALINA_HOME \
-Dcatalina.base=$CATALINA_BASE \
-Djava.io.tmpdir=$TMP_DIR \
-wait 10 \
-pidfile $PID_FILE \
-outfile $CATALINA_HOME/logs/catalina.out \
-errfile '&1' \
$CATALINA_OPTS \
-cp $CLASSPATH \
org.apache.catalina.startup.Bootstrap
echo"*****************************[ok]"
}
stop() {
echo -n $"Stopping Tomcat6: "
#
$DAEMON_HOME/jsvc \
-stop \
-pidfile $PID_FILE \
org.apache.catalina.startup.Bootstrap
echo "*****************************[ok]"
}
status() {
ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap" | awk '{printf $1 " "}' | wc | awk '{print $2}' >/tmp/tomcat_process_count.txt
read line < /tmp/tomcat_process_count.txt
if [ $line -gt 0 ]; then
echo -n "tomcat6 ( pid "
ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap" | awk '{printf $1 " "}'
echo ") is running "
else
echo "Tomcat6 is stopped"
fi
}
case "$1" in
start)
# Start Tomcat
start
exit $?
;;
stop)
# Stop Tomcat
stop
exit $?
;;
restart)
# Restart Tomcat
stop
sleep 3
start
exit $?
;;
status)
status
exit $?
;;
*)
echo "Usage: tomcat6 {start|stop|restart|status}"
exit 1;;
esac
#####
####
11、录入完成,按Esc键。输入: wq保存退出并赋予/etc/init.d/tomcat6文件可执行权限
[root@localhost~]# chmod 777 /etc/init.d/tomcat6
------------------添加服务-----------------------------------------
12、[root@localhost~] #chkconfig --add tomcat6 ##添加tomcat服务
13、[root@localhost~] #chkconfig –list |grep tomcat6 ##查看tomcat服务是否被添加
--------------------启动服务---------------------------------------------
14、[root@localhost~] # service tomcat6 start ##启动tomcat服务
15、[root@localhost~] # service tomcat6 stop ##停止tomcat服务
16、[root@localhost~] # service tomcat6 restart ##重启tomcat
17、[root@localhost~] # service tomcat6 status ##查看tomcat服务启动状态
lunux 启动 tomcat的更多相关文章
- eclipse启动tomcat无法访问
eclipse启动tomcat无法访问 症状: tomcat在eclipse里面能正常启动,而在浏览器中访问http://localhost:8080/不能访问,且报404错误.同时其他项目页面也不能 ...
- Error configuring application listener of class。。。NoClassDefFoundError。。某Listener 之启动tomcat报错
当你启动tomcat的时候如果报类似下面的错误: WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to ' ...
- eclipse启动tomcat, http://localhost:8080无法访问
原地址 症状: tomcat在eclipse里面能正常启动,而在浏览器中访问http://localhost:8080/不能访问,且报404错误.同时其他项目页面也不能访问. 关闭eclipse里面的 ...
- Eclipse启动Tomcat时发生java.lang.IllegalArgumentException: <session-config> element is limited to 1 occurrence
在学习struts 2时,为了方便,直接从下载的struts的apps目录下的struts2-blank.war压缩包下的WEB-INF\复制的web.xml,当我启动Tomcat时,发生 java. ...
- Mac下没有权限启动tomcat的解决办法
问题描述 在Mac中通过./startup.sh执行启动脚本文件,启动tomcat时报如下错误: -bash: ./startup.sh: Permission denied 解决方法 错误信息说明了 ...
- maven 项目启动tomcat报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
maven项目启动tomcat报错: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...
- 直接启动tomcat时为tomcat指定JDK
第一种: 在windows环境下以批处理文件方式启动tomcat,只要运行<CATALINA_HOME>/bin/startup.bat这个文件,就可以启动Tomcat.在启动时,star ...
- [转]Eclipse启动Tomcat时45秒超时解决方法
原文地址:http://it.oyksoft.com/post/6577/ Eclipse启动Tomcat时,默认配置的启动超时时长为45秒.假若项目启动超过45秒将会报错.两种解决方法:1.改XML ...
- 启动Tomcat报异常host-manager does not exist or is not a readable directory
前几天重新安装了Tomcat6,安装完Tomcat6后在wepapps下面会有一些tomcat自带的项目(root.manager.host- manager等几个),这几天项目没什么用我就删掉了,后 ...
随机推荐
- GForms 快速入门指南
本文旨在帮助您快速安装.创建及运行GForms应用. 1. 启动GForms Eclipse 如果您没有GForms安装介质,请到如下地址:http://yun. baidu .com/s/1bn ...
- (转)RabbitMQ消息队列(七):适用于云计算集群的远程调用(RPC)
在云计算环境中,很多时候需要用它其他机器的计算资源,我们有可能会在接收到Message进行处理时,会把一部分计算任务分配到其他节点来完成.那么,RabbitMQ如何使用RPC呢?在本篇文章中,我们将会 ...
- javaScript中的数组迭代方法
ECMAScript5为数组定义了5个迭代方法. 每个方法都接收两个参数:要在每一项上运行的函数 和 (可选的)运行该函数的作用域对象. 传入这些方法中的函数会接收三个参数:数组项的值,该项在数组 ...
- CSS样式表与格式布局
样式表 CSS(Cascading Style Sheets 层叠样式表),作用是美化HTML网页. 内联样式表: 例:<p style="font-size:10px;" ...
- 单机版简单弹幕墙demo (jqery+bootstrap)
最近在看fcc ,上面有一个弹幕墙设计的题目,要求从后端获取数据,显示出来.百度,谷歌都没找到相关好的例子作为借鉴,索性按照自己的思路写了一个简单的demo .在做demo的过程中遇到最大的问题就 ...
- maven 练习
新建项目: Next next next 新建项目后,MyEclipse会自动从远程仓库中下载支持包,需要几分钟左右时间. 项目结构图: HelloWorld.java public class He ...
- Model Builder中Table2Table中字段映射的问题
ArcGIS10中使用过程中,Bug不少.尽管有了SP3,但模型耦合的深层次的应用中还是错误不少.目前只是遇到一个,利用躲避的方法解决一个.例如,从NetCDF中抽出的数据表,必须在内存和数据库中都存 ...
- C++ 嵌入汇编 获取CPU信息
#include "windows.h" #include "iostream" #include "string" using names ...
- 安装Java EE失败,解决方案
笔者安装Java EE(版本是java_ee_sdk-7-jdk7-windows-x64-ml.exe)时,遇到错误提示提示"Could not find the required ver ...
- The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.问题解决
didFailLoadWithError(): Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loa ...