DOC

apachetomcat

By Leonard Price,2014-06-02 13:59
9 views 0
apachetomcat

    说说说明;系redhat enterprise linux 5 update 2

     定制最小化安装

     本机IP地址:192.168.0.253

    1. 搭建本地yum

     [root@tomcat ~]# mount /dev/cdrom /mntmount: block device /dev/cdrom is

    write-protected, mounting read-only[root@tomcat ~]# vi

    /etc/yum.repos.d/local.repo

    [rhel5-local]

    name=Red Hat Enterprise Linux 5

    Local Repository

    baseurl=file:///mnt/Server

    enabled=1

    gpgcheck=0

    [root@tomcat ~]# yum install gcc

    [root@tomcat ~]# yum install

    openssl*

    2. 安装apache

     [root@tomcat ~]# cd /usr/local/src/[root@tomcat src]# ls

    apache-tomcat-6.0.18.tar.gz jaf-1_0_2-upd2.zip jdk-6u13-linux-i586.bin

    tomcat-connectors-1.2.28-src.tar.gzhttpd-2.2.11.tar.bz2 javamail-1.4.2.zip mysql-connector-java-

    5.1.7.tar.gz.tar

    [root@tomcat src]# tar jxvf httpd-2.2.11.tar.bz2[root@tomcat src]# cd httpd-2.2.11[root@tomcat httpd-2.2.11]#

    ./configure --prefix=/usr/local/httpd --with-mpm=worker --enable-cache

    --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-mime-

    magic

    --enable-headers --enable-ssl --enable-http --enable-cgi --enable-rewrite

    --enable-so --with-suexec-gidmin --with-suexec-logfile

    [root@tomcat httpd-2.2.11]#

    make

    [root@tomcat httpd-2.2.11]#

    make install

    [root@tomcat httpd-2.2.11]#

    cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/apache

    [root@tomcat httpd-2.2.11]#

    /etc/rc.d/init.d/apache start

    httpd: apr_sockaddr_info_get()

    failed for tomcat

    httpd: Could not reliably

    determine the server's fully qualified domain name, using 127.0.0.1 for

    ServerName

    [root@tomcat httpd-2.2.11]#

    vi /usr/local/httpd/conf/httpd.confServerName localhost:80 说说说

    [root@tomcat httpd-2.2.11]#

    /etc/rc.d/init.d/apache stop

    [root@tomcat httpd-2.2.11]#

/etc/rc.d/init.d/apache start

    [root@tomcat httpd-2.2.11]#

    ps aux | grep httpd; netstat -ntulp | grep :80root 29285

    0.5 0.4 7420

    2476 ? Ss 17:20

    0:00 /usr/local/httpd/bin/httpd -k start

    daemon 29286

    0.0 0.3 7192

    1564 ? S 17:20

    0:00 /usr/local/httpd/bin/httpd -k start

    daemon 29287

    0.0 0.3 284056 1936 ?

    Sl 17:20 0:00 /usr/local/httpd/bin/httpd -k startdaemon 29289

    0.0 0.3 284056 1940 ?

    Sl 17:20 0:00 /usr/local/httpd/bin/httpd -k startdaemon 29291

    0.0 0.3 284056 1940 ?

    Sl 17:20

    0:00 /usr/local/httpd/bin/httpd -k start

    root 29372

    0.0 0.1 3904

    672 pts/0 R+

    17:20 0:00 grep httpd

    tcp 0

    0 :::80

    :::* LISTEN 29285/httpd 3.安装tomcat

    [root@tomcat httpd-2.2.11]#

    cd ..

    [root@tomcat src]# mv

    apache-tomcat-6.0.18.tar.gz

    tomcat-connectors-1.2.28-src.tar.gz jdk-6u13-linux-i586.bin jaf-1_0_2-

    upd2.zip

    javamail-1.4.2.zip /opt

    [root@tomcat src]# cd /opt/

    [root@tomcat opt]# ls

    apache-tomcat-6.0.18.tar.gz jaf-1_0_2-upd2.zip javamail-1.4.2.zip jdk-

    6u13-linux-i586.bin tomcat-connectors-1.2.28-src.tar.gz[root@tomcat opt]# tar zxvf

    apache-tomcat-6.0.18.tar.gz ; unzip

    jaf-1_0_2-upd2.zip ; unzip javamail-1.4.2.zip ; tar zxvftomcat-connectors-1.2.28-src.tar.gz ;

    chmod +x jdk-6u13-linux-i586.bin

    [root@tomcat opt]# ls

    apache-tomcat-6.0.18 jaf-1.0.2 javamail-1.4.2 jdk-6u13-

    linux-i586.bin tomcat-connectors-1.2.28-src.tar.gzapache-tomcat-6.0.18.tar.gz jaf-1_0_2-upd2.zip javamail-1.4.2.zip tomcat-

    connectors-1.2.28-src

    安装sun javaJDK

    [root@tomcat opt]#

    ./jdk-6u13-linux-i586.bin

    Sun Microsystems, Inc. Binary Code License

Agreement

    for the JAVA SE DEVELOPMENT KIT (JDK), VERSION 6--More--

    ~~~~~~~~~~~~~~~~~ignore~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ~~~~~~~~~

    THIRDPARTYLICENSEREADME.txt

    file, the disclaimer of

    warranty and

    limitation of liability provisions inparagraphs 5 and 6

    of the Binary Code License Agreementshall apply to all

    Software in this distribution.

    H. Termination for

    Infringement. Either party may terminatethis Agreement

    immediately should any Software become, orin either party's

    opinion be likely to become, the subjectof a claim of

    infringement of any intellectual propertyright.

    I. Installation and

    Auto-Update. The Software's

    installation and

    auto-update processes transmit a limitedamount of data to

    Sun (or its service provider) about thosespecific processes

    to help Sun understand and optimizethem. Sun does not

    associate the data with personallyidentifiable

    information. You can find more informationabout the data Sun

    collects at http://java.com/data/.For inquiries please

    contact: Sun Microsystems, Inc., 4150Network Circle, Santa Clara, California95054, U.S.A.

    Do you agree to the

    above license terms? [yes or no]yes

    ~~~~~~~~~~~~~~~~~~~ignore~~~~~~~~~~~~~~~~~~~~~``Java(TM) SE

    Development Kit 6 successfully installed.Product Registration

    is FREE and includes many benefits:* Notification of

    new versions, patches, and updates* Special offers on

    Sun products, services and training* Access to early

    releases and documentation

Product and system

    data will be collected. If your configurationsupports a browser,

    the Sun Product Registration form forthe JDK will be

    presented. If you do not register, none ofthis information

    will be saved. You may also register yourJDK later by opening

    the register.html file (located in

    the JDK installation

    directory) in a browser.

    For more information

    on what data Registration collects andhow it is managed

    and used, see:

    http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

    Press Enter to

    continue.....

    Done.

    [root@tomcat opt]# mv

    apache-tomcat-6.0.18 tomcat; mv jdk1.6.0_13 java;mv jaf-1.0.2 jaf; mv javamail-1.4.2 java[root@tomcat opt]# ls

    apache-tomcat-6.0.18.tar.gz jaf-1_0_2-upd2.zip javamail-1.4.2.zip

    tomcat tomcat-connectors-1.2.28-src.tar.gz

    jaf java jdk-6u13-linux-i586.bin tomcat-

    connectors-1.2.28-src

    说说说说说定境量

    [root@tomcat opt]# vi /etc/profile

    JAVA_HOME=/opt/java

    CATALINA_HOME=/usr/local/tomcat

    CATALINA_BASE=/usr/local/tomcat

    CLASSPATH=./:${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib/ext:$

    {CATALINA_HOME}/common/lib:/opt/javamail/mail.jar:/opt/jaf/activation.jar

    export JAVA_HOME CATALINA_HOME

    CATALINA_BASE CLASSPATH

    export

    PATH=${JAVA_HOME}/bin:${CATALINA_HOME}/bin:${PATH}使用source.指令使修改生效

    [root@tomcat opt]# source

    /etc/profile

    [root@tomcat opt]# cd

    tomcat-connectors-1.2.28-src/native/说说mod_jk

    [root@tomcat native]# ./configure

    --with-java-home=/usr/local/java

    --with-apxs=/usr/local/httpd/bin/apxs[root@tomcat native]# make

    安装mod_jkhttpd

    [root@tomcat native]# cp

    apache-2.0/mod_jk.so /usr/local/httpd/lib/[root@tomcat native]#cd /opt

[root@tomcat opt]# vi

    /usr/local/httpd/conf/httpd.conf加入如下3,mod_jk模与说说mod_jk说说说定档目

    LoadModule jk_module lib/mod_jk.so# mod_jk settings

    Include conf/mod_jk.conf

    [root@tomcat opt]# cd

    /usr/local/httpd/conf/

    [root@tomcat conf]# touch

    mod_jk.conf

    [root@tomcat conf]# vi mod_jk.conf#setup the workers.properties filepath, default prefix path is httpd's home (/usr/local/httpd)

    JkWorkersFile conf/workers.propertiesJkLogFile /var/log/jk.log

    JkShmFile

    /var/log/jk-runtime-status

    JkLogLevel error

    JkLogStampFormat "[%a %b %d%H:%M:%S %Y] "

    JkOptions +ForwardKeySize

    +ForwardURICompat -ForwardDirectoriesJkRequestLogFormat "%w %V

    %T"

    # Sample JkMounts. Replace thesewith the paths you would

    # like to mount from your JSPserver.

    # syntax: JkMount ${URL_DIR}/*.jspworker_name

    JkMount /project1/*.jsp jsp-ap207JkMount /project2/*.jsp jsp-ap207JkMount /project3/*.jsp jsp-ap207[root@tomcat conf]# touch

    workers.properties

    [root@tomcat conf]# vi

    workers.properties

    # BEGIN workers.properties

    # setting tomcat_home and

    java_home

    workers.tomcat_home=/opt/tomcatworkers.java_home=/opt/java# worker.list defined worker_name,used by mod_jk.conf

    worker.list=jsp-ap207

    worker.jsp-ap207.port=8009

    worker.jsp-ap207.host=192.168.0.253worker.jsp-ap207.type=ajp13worker.jsp-ap207.lbfactor=1[root@tomcat conf]# cd /opt/[root@tomcat opt]# vi

    tomcat/conf/server.xml

    unpackWARs="true"

    autoDeploy="true">

debug="5"

    reloadable="true" crossContext="true">[root@tomcat opt]# mkdir -p

    "/projects/project1"; cd /projects/project1

    [root@tomcat project1]#

    /etc/rc.d/init.d/apache stop[root@tomcat project1]#

    /etc/rc.d/init.d/apache start[root@tomcat project1]#

    /opt/tomcat/bin/startup.sh

    Using CATALINA_BASE: /opt/tomcatUsing CATALINA_HOME: /opt/tomcatUsing CATALINA_TMPDIR:

    /opt/tomcat/temp

    Using JRE_HOME: /opt/java说说

    [root@tomcat project1]# vi

    hello.jsp

    String str1="Hello

    World!";

    out.println(str1);

    %>

Report this document

For any questions or suggestions please email
cust-service@docsford.com