[五]安裝 Java 與 Tomcat:
J2SDK: 檔案j2sdk-1_4_1_05-linux-i586-rpm.bin    ( 自訂:視自己想要的版本而定喔!)

#chmod 755 j2sdk-1_4_1_05-linux-i586-rpm.bin
#./j2sdk-1_4_1_05-linux-i586-rpm.bin

執行後,它會顯示版權宣告,並出現下列訊息:
Do you agree to the above license terms? [yes or no]
yes
Unpacking...
Checksumming...
0
0
Extracting...
UnZipSFX 5.40 of 28 November 1998, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: j2sdk-1_4_1_05-fcs-linux-i586.rpm
Done.
#

解壓後再做安裝命令如下:

#rpm -ivh j2sdk-1_4_1_05-linux-i586.rpm

安裝後請檢視目錄 /usr/java 是否有產生 j2sdk1.4.1_05 這個目錄。    ( 注意版本喔!!)

====================================================
Linux安裝TOMCAT   檔案: jakarta-tomcat-4.1.29.tar.gz

tar zxvf jakarta-tomcat-4.1.29.tar.gz
mv jakarta-tomcat-4.1.29/ /usr/local/tomcat
cd /usr/local
chmod -R 755 tomcat


1) 下載最新的JK2 http://www.apache.org/dist/jakarta/tomcat-connectors/jk2/jakarta-tomcat-connectors-jk2-src-current.tar.gz

2)安裝 JK2 模組:
# cd /home/myhome/software/
# tar zxvf jakarta-tomcat-connectors-jk2-src-current.tar.gz
# cd jk2/jk/native2
# ./buildconf.sh
# ./configure --with-apxs2=/usr/local/apache/bin/apxs
# make
# make install

# cp /home/myhome/software/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/build/jk2/apache2/mod_jk2.so /usr/local/apache/modules


3) 把mod_jk2加入 httpd.conf中
# vi /usr/local/apache/conf/httpd.conf
LoadModule jk2_module modules/mod_jk2.so

4) vi /usr/local/tomcat/conf/jk2.properties
把原有位置的相關檔換成下面這些:

# list of needed handlers.
handler.list=channelSocket,request
# Override the default port for the channelSocket
channelSocket.port=8009

 

5) vi /usr/local/apache/conf/workers2.properties
這個是設定檔,
請參考著修改:
# only at beginnin. In production uncomment it out
[logger.apache2]
level=DEBUG

[shm]
file=/usr/local/apache/logs/shm.file
size=1048576

# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1

# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

# Uri mapping
[uri:127.0.0.1/*.jsp]
worker=ajp13:localhost:8009

[uri:myip.ip.com/*.jsp]
worker=ajp13:localhost:8009


6) vi /usr/local/apache/conf/httpd.conf 虛擬主機配置部分

#…………
#不相關的部分已經省略

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin myemil@test.mail.com
DocumentRoot /home/myhome/tomcat_web
ServerName www.myip.org
ErrorLog logs/myweb-error_log
CustomLog logs/myweb-access_log common
Options None
</VirtualHost>

 

7) server.xml 的設定
# vi /usr/local/tomcat/conf/server.xml 的設定


<Server port="8005" shutdown="SHUTDOWN" debug="0">
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>;
      </parameter>
      <parameter>
        <name>pathname</name>;
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

  </GlobalNamingResources>
  <Service name="Catalina">
    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->;
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
               enableLookups="false" redirectPort="8443" debug="0"
               protocol="AJP/1.3" />

    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost" debug="0">

      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>

      <!-- Because this Realm is here, an instance will be shared globally -->

      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 debug="0" resourceName="UserDatabase"/>

      <Host name="localhost" debug="0" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
            timestamp="true"/>

        <!-- Tomcat Root Context -->
        <!--
          <Context path="" docBase="ROOT" debug="0">
        -->

      </Host>

      <Host name="hsinichi.no-ip.org" debug="0" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="lawcn_log." suffix=".txt"
            timestamp="true"/>
          <Context path="" docBase="lawcn" debug="0" />
      </Host>

    </Engine>

  </Service>

</Server>

====================================================
----------tomcat 4.1.31 VirtualHost 設法---------------
#mkdir -p /home/myhome/tomcat_web/
#mkdir -p /home/myhome/tomcat_web/logs
#vi server.xml
     <Host name="hsinichi.no-ip.org" appBase="/home/myhome/tomcat_web" unpackWARs="true" autoDeploy="true">
       <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="/home/myhome/tomcat_web/logs"  prefix="web_log." suffix=".txt"
            timestamp="true"/>
         <Context path="" docBase="."/>
     </Host>

 

 
創作者介紹

資訊理想化的延伸

hsinichi 發表在 痞客邦 PIXNET 留言(0) 人氣()