linux中下载的服务压缩包存放在,linux 下tomcat6 配置为服务
本人從官網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:
#
#????
#????
#???????????????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.Bootstrapecho"*****************************[ok]"
}
stop()?{
echo?-n?$"Stopping?Tomcat6:?"#$DAEMON_HOME/jsvc?\
-stop?\
-pidfile?$PID_FILE?\
org.apache.catalina.startup.Bootstrapecho "*****************************[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?
echo?-n"tomcat6?(?pid?"ps?ax?--width=1000?|?grep"[o]rg.apache.catalina.startup.Bootstrap"|?awk'{printf?$1?"?"}'echo")?is?running"elseecho"Tomcat6?is?stopped"fi
}
case"$1"instart)#?Start?Tomcatstart
exit?$?
;;
stop)#?Stop?Tomcatstop
exit?$?
;;
restart)#?Restart?Tomcatstop
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 �Clist |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服務啟動狀態
總結
以上是生活随笔為你收集整理的linux中下载的服务压缩包存放在,linux 下tomcat6 配置为服务的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux 编译安装python,lin
- 下一篇: 《寻人大师》剧情播出时间介绍 根据什么故