`

ubuntu8.04 下安装tomcat6,并开机自启动

阅读更多
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 11"> <meta name="Originator" content="Microsoft Word 11"> <link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"> <smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="chsdate"></smarttagtype><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL/> <w:BalanceSingleByteDoubleByteWidth/> <w:DoNotLeaveBackslashAlone/> <w:ULTrailSpace/> <w:DoNotExpandShiftReturn/> <w:AdjustLineHeightInTable/> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:UseFELayout/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles deflockedstate="false" latentstylecount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]><object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id="ieooui"></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"\@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:none; mso-hyphenate:none; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:.5pt; mso-fareast-language:#00FF;} a:link, span.MsoHyperlink {mso-style-parent:""; color:navy; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} p.a, li.a, div.a {mso-style-name:表格内容; margin:0cm; margin-bottom:.0001pt; mso-pagination:no-line-numbers; mso-hyphenate:none; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:.5pt; mso-fareast-language:#00FF;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.25pt 841.85pt; margin:2.0cm 2.0cm 2.0cm 2.0cm; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1; mso-footnote-position:beneath-text;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->

整合网络上的各种零散的资料,并经过本人的实践操作,整理,转载请注明出处。

1.安装jdk6

       shell>sudo apt-get install sun-java6-jdk(用新得立软件包安装)

2.下载tomcat6

       下载地址是:http://tomcat.apache.org/

       本次安装的是:apache-tomcat-<chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">6.0.18</chsdate>.tar.gz

3.安装

       将压缩包拷贝到 /opt 下(个人喜好,可以放在别处)

              shell>sudo cp apache-tomcat-<chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">6.0.18</chsdate>.tar.gz /opt

       解压文件

              shell>cd /opt

              shell>sudo tar zxvf apache-tomcat-<chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">6.0.18</chsdate>.tar.gz

       解压完成后,会在 /opt 下生文件夹 apache-tomcat-<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on">6.0.18</chsdate>

       为了操作方便,在/usr/local 下建立软链接,名字是tomcat6

              shell>cd /usr/local

shell>sudo ln -s /opt/apache-tomcat-<chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">6.0.18</chsdate> tomcat6

       测试tomcat是否能够正常启动

              shell>sudo /usr/local/tomcat6/bin/startup.sh

              打开firefox,输入http://localhost:8080,如果正常访问,则表示成功。

4.设置tomcat开机自启动

       根据tomcat官方的document说明,linux下设置开机自启动可以使用jsvctomcat包里自带)

       设置tomcat以独立的用户运行(防止以root运行,权限太大)

              shell>sudo useradd -d /usr/local/tomcat6 -s /usr/sbin/nologin tomcat

              上边的这个命令是添加一个系统用户tomcat,并且设置为不可登录系统。

       设置用户tomcat tomcat6的访问权限

              shell>sudo chown -R tomcat:tomcat /usr/local/tomcat6

              shell>sudo chown -R tomcat:tomcat /opt/apache-tomcat-<chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">6.0.18</chsdate>

       安装jsvc

              前提需要系统安装了gcc(系统一般默认安装)autoconflibc6-dev

                     shell>sudo apt-get install .....

              解压jsvc.tar.gz,并准备编译

                     shell>cd /usr/local/tomcat6/bin

                     shell>sudo tar zxvf jsvc.tar.gz

                     shell>cd jsvc-src

                     shell>sudo sh support/buildconf.sh

                     如果成功,命令终端会打出:

                            support/buildconf.sh: configure script generated successfully

              configure添加执行权限

                     shell>sudo chmod 755 configure

              编译     

                     shell>sudo ./configure –with-java=/usr/lib/jvm/java-6-sun (java的安装路径)

                     shell>sudo make

                      如果没有出现错误,jsvc就安装成功了。

              设置启动脚本

                     拷贝jsvc带的tomcat5.sh 脚本拷贝到 /etc/init.d/ 下,并改名为tomcat

                     shell>sudo cp /usr/local/tomcat6/bin/jsvc-src/native/Tomcat5.sh /etc/init.d/tomcat

               修改/etc/init.d/tomcat文件

                     shell>sudo gedit /etc/init.d/tomcat

 

              文件内容如下(修改的地方有颜色和注释说明):

#!/bin/sh

##############################################################################

#

#   Copyright 2004 The Apache Software Foundation.

#

#   Licensed under the Apache License, Version 2.0 (the "License");

#   you may not use this file except in compliance with the License.

#   You may obtain a copy of the License at

#

#       http://www.apache.org/licenses/LICENSE-2.0

#

#   Unless required by applicable law or agreed to in writing, software

#   distributed under the License is distributed on an "AS IS" BASIS,

#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

#   See the License for the specific language governing permissions and

#   limitations under the License.

##############################################################################

#

# 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"/>

#

# That is for Tomcat-5.0.x (Apache Tomcat/5.0)

#

# Adapt the following lines to your configuration

JAVA_HOME=/usr/lib/jvm/java-6-sun

              #这个地方设置为机器的jdk的位置

CATALINA_HOME=/usr/local/tomcat6            #tomcat的安装位置(软链接)

DAEMON_HOME=/usr/local/tomcat6/bin       #tomcat启动程序的位置

TOMCAT_USER=tomcat                                  #tomcat 的用户

 

 

# for multi instances adapt those lines.

TMP_DIR=/var/tmp

PID_FILE=/var/run/jsvc.pid

CATALINA_BASE=/usr/local/tomcat6             #tomcat的安装位置

 

#注释掉下边这句


#CATALINA_OPTS="-Djava.library.path=/home/jfclere/jakarta-tomcat-connectors/jni/native/.libs"

#添加下边这句

CATALINA_OPTS=

CLASSPATH=\

$JAVA_HOME/lib/tools.jar:\

$CATALINA_HOME/bin/commons-daemon.jar:\

$CATALINA_HOME/bin/bootstrap.jar

 

 

case "$1" in

  start)

    #

    # Start Tomcat

    #

    $DAEMON_HOME/jsvc-src/jsvc \                #设置正确的jsvc程序的位置

    -user $TOMCAT_USER \

    -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

    #

    # To get a verbose JVM

    #-verbose \

    # To get a debug of jsvc.

    #-debug \

    exit $?

    ;;

 

 

  stop)

    #

    # Stop Tomcat

    #

    $DAEMON_HOME/jsvc-src/jsvc \                      #设置正确的jsvc程序的位置

    -stop \

    -pidfile $PID_FILE \

    org.apache.catalina.startup.Bootstrap

    exit $?

    ;;

 

 

  *)

    echo "Usage tomcat.sh start/stop"

    exit 1;;

esac

 

       设置 /etc/init.d/tomcat的可执行权限

              Shell>sudo chmod 755 /etc/init.d/tomcat

/etc/rc2.d/下设置一个/etc/init.d/tomcat 的软链接

              shell>cd /etc/rc2.d/

              shell>sudo ln -s /etc/init.d/tomcat S16tomcat

              [:rc2.d目录下的文件要以S后就数字开头,表示启动的顺序。而rc2.d中的2,表示这个目录下文件在开机时的运行级别(runlevel)2]

 

5.结束

       重新启动系统 shell>sudo reboot –n, 启动后,就可以在FF中直接输入http://localhost:8080 ,如果看到首页,即表示安装成功

             

      

分享到:
评论

相关推荐

    ubuntu 8.04 安装g++

    Ubuntu 8.04 安装 G++ 详解 在 Ubuntu 8.04 系统中安装 G++ 编译器是非常必要的,特别是在配置 okl4 环境时。下面将详细介绍如何在 Ubuntu 8.04 中安装 G++。 首先,需要安装 build-essential 软件包,该软件包包...

    Ubuntu8.04安装教程

    总结,安装Ubuntu 8.04需要准备ISO镜像、制作启动盘、调整启动顺序,然后按照安装向导进行操作。安装过程中注意选择合适的分区方式,以及确保硬件驱动的兼容性。一旦安装成功,记得及时更新系统并安装所需的软件,以...

    详解:Vmware虚拟机下Ubuntu8.04安装.pdf

    Vmware虚拟机下Ubuntu 8.04安装 Vmware虚拟机下Ubuntu 8.04安装可以分为两个部分:Vmware虚拟环境的安装和Ubuntu系统的安装。在Vmware虚拟环境的安装中,我们需要首先安装Vmware Workstation,然后创建一个新的...

    ubuntu8.04中配置java+tomcat+eclipseMyEclipse开发环境(更新)

    本文将深入解析如何在Ubuntu 8.04系统上搭建这套开发环境,涵盖Java环境的配置、Tomcat服务器的安装与启动、以及集成开发环境Eclipse MyEclipse的设置。 ### Java环境配置 #### 安装Java运行环境与开发工具包(JDK)...

    Ubuntu8.04安装配置大全

    ### Ubuntu 8.04 安装与配置详解 #### 一、系统初始化 系统初始化是确保Ubuntu系统正常运行的基础步骤。此阶段涉及到的操作主要包括硬盘分区、安装过程中的选择(如语言、时区等),以及安装后的基础设置,如更新...

    ubuntu8.04完全安装指南

    安装前,你需要下载并安装虚拟光驱软件来加载ubuntu-8.04-desktop-i386.iso镜像。挂载ISO后,系统会自动弹出Ubuntu的安装菜单。选择"Install inside Windows"选项进入Wubi安装程序。在这里,选择你预备好的足够空间...

    Ubuntu 8.04桌面版安装教程

    安装完成后,系统会提示取出安装光盘并重新启动,最终进入Ubuntu 8.04的桌面环境,预装了Firefox浏览器的3.0b5版本。 总的来说,Ubuntu 8.04在硬件支持、易用性、安全性和多媒体功能方面都有显著提升,为用户提供了...

    如何在ubuntu8.04中安装中文输入法

    本文将详细介绍如何在Ubuntu 8.04系统中安装并配置中文输入法。对于初次接触Ubuntu的用户来说,这是一个非常实用的指南。Ubuntu 8.04(Hardy Heron)是一款非常经典的Linux发行版,其内置了SCIM(Smart Common Input...

    Ubuntu 8.04 Server版 安装图解

    Ubuntu 8.04 Server版安装图解 很完整

    ubuntu8.04默认的源

    ubuntu8.04默认的源ubuntu8.04默认的源ubuntu8.04默认的源ubuntu8.04默认的源ubuntu8.04默认的源ubuntu8.04默认的源ubuntu8.04默认的源ubuntu8.04默认的源

    ubuntu8.04优化指南

    本文将详细介绍如何在仅有 128MB 内存甚至更低配置的机器上安装并优化 Ubuntu 8.04。 #### 二、安装 Ubuntu 8.04 由于 Ubuntu 8.04 的 LiveCD 需要至少 384MB 的内存才能运行,因此无法通过 LiveCD 来安装系统。在...

    ubuntu8.04速成手册1.0.rar ubuntu8.04 ubuntu8安装与配置

    在安装部分,手册会引导读者了解如何下载Ubuntu 8.04的ISO镜像文件,并提供多种安装方式,包括光盘、USB驱动器或网络安装。安装过程中会涉及BIOS设置、分区管理、选择安装类型(如图形化桌面环境或服务器版)等关键...

    ubuntu8.04使用手册

    ubuntu8.04使用手册,ubuntu8.04使用手册ubuntu8.04使用手册,ubuntu8.04使用手册,ubuntu8.04使用手册,

    ubuntu8.04速成手册1.0.pdf

    1. **Ubuntu安装与启动**:手册首先会介绍如何下载Ubuntu 8.04的ISO镜像,然后使用USB驱动器或CD/DVD进行安装。这包括创建启动媒体、设置BIOS以从USB或光驱启动,以及在安装过程中选择合适的分区方式,如并行安装、...

    同事安装ubuntu8.04和windows

    8. **重启并更新**:安装完成后,重启计算机,然后在启动菜单中选择Ubuntu。首次登录后,应立即进行系统更新,以获取最新的安全补丁和软件版本。 通过遵循这个教程,用户应该能够成功地在Thinkpad T61上建立Ubuntu ...

    Ubuntu 8.04硬盘安装资源

    里面包括grub020p;vmlinuz;initrd 我用这三个成功的硬盘安装了ubuntu-8.04-alternate-i386 又要用的看一下。 安装步骤其实很简单,如果有不会的可以看我的Blog相关内容 j2me.zor.org

    ubuntu 8.04上安装和设置samba服务

    完成以上步骤后,Ubuntu 8.04上的Samba服务已经安装并配置好,可以与Windows或其他支持SMB协议的系统进行文件共享。请注意,为了系统安全,最好限制不必要的访问权限,并定期更新Samba软件以获取最新的安全补丁。

    硬盘安装ubuntu8.04

    2. **启动安装程序**:Grub4DOS会加载Ubuntu的安装程序,从硬盘启动ISO。 3. **语言选择**:根据提示选择合适的语言和地区。 4. **安装类型**:选择“自定义安装”,指定先前准备好的分区进行安装。 5. **安装组件**...

    ubuntu8.04速成手册

    手册首先会介绍Ubuntu的安装过程,包括如何下载ISO镜像、创建启动U盘、设置BIOS以从USB或DVD启动,以及如何选择安装类型(如默认的桌面版、服务器版或者LXDE轻量级桌面)。此外,还可能涵盖分区策略,以确保数据安全...

Global site tag (gtag.js) - Google Analytics