Tomcat5-讓您的主機能跑JSP

发表于:2007-06-09来源:作者:点击数: 标签:
http://www.weithenn.idv.tw/cgi-bin/wiki.pl/Tomcat5-%e8%ae%93%e6%82%a8%e7%9a%84%e4%b8%bb%e6%a9%9f%e8%83%bd%e8%b7%91JSP 【前言】 [Jakarta Tomcat] 是Sun和Apache協力合作所開發出來Java Servlet及Java Server Pages平台,為目前在世界上使用最廣的JSP
http://www.weithenn.idv.tw/cgi-bin/wiki.pl/Tomcat5-%e8%ae%93%e6%82%a8%e7%9a%84%e4%b8%bb%e6%a9%9f%e8%83%bd%e8%b7%91JSP

【前言】

[Jakarta Tomcat] 是Sun和Apache協力合作所開發出來Java Servlet及Java Server Pages平台,為目前在世界上使用最廣的JSP 平台。

【作業環境】

FreeBSD 5.2-RELEASE

linux_base-7.1_7

jakarta-tomcat-5.0.25

JDK1.4.2

【安裝及設定】

Setp1.安裝Linux Base套件

切換至安裝路徑-->安裝套件-->修改rc.conf-->將linux base載入kernel

 #cd /usr/ports/emulators/linux_base   //切換至安裝路徑

 #make install clean                   //安裝套件並清除安裝過程中產生不必要檔案

 #vi /etc/rc.conf                      //修改rc.conf

 //這入此行以便於開機時自動載入linux.ko

 linux_enable="YES"

 #kldstat                              //確定linux base是否有載入至kernel

 Id Refs Address Size Name

 3 1 0xc4794000 19000 linux.ko

Setp2.安裝Tomcat5套件

切換至安裝路徑-->安裝套件-->下載相關套件再行安裝

 #cd /usr/ports/www/jakarta-tomcat5     //切換至安裝路徑

 #make install clean                    //安裝套件途中出現如下錯誤訊息

 ===> Configuring for jakarta-tomcat-5.0.25

 ===> Installing for jakarta-tomcat-5.0.25

 ===> jakarta-tomcat-5.0.25 depends on file: /usr/local/jdk1.4.2/bin/java - not found

 ===> Verifying install for /usr/local/jdk1.4.2/bin/java in /usr/ports/java/jdk14

 ===> jdk-1.4.2p6_4 :

 The source distribution exists on your system, but due to licensing  restrictions you still need to download thepatchset,  bsd-jdk14-patches-6.tar.gz, from 

 http://www.eyesbeyond.com/freebsddom/java/jdk14.html.

 Please place the patchset in /usr/ports/distfiles.

 .*** Error code 1

 Stop in /usr/ports/java/jdk14.

 *** Error code 1

 Stop in /usr/ports/www/jakarta-tomcat5.

由上述訊息可知叫您至http://www.eyesbeyond.com/freebsddom/java/jdk14.html.下載bsd-jdk14-patches-6.tar.gz並放到/usr/ports/distfiles.在執行一次make install clean

 ===> Installing for jakarta-tomcat-5.0.25

 ===> jakarta-tomcat-5.0.25 depends on file: /usr/local/jdk1.4.2/bin/java - not found

 ===> Verifying install for /usr/local/jdk1.4.2/bin/java in /usr/ports/java/jdk14

 ===> jdk-1.4.2p6_4 :

 Because of licensing restrictions, you must fetch the source distribution

 manually. Please aclearcase/" target="_blank" >ccess http://www.sun.com/software/java2/download.html

 with a web browser and follow the "Download" link for the

 "Java(TM) SDK 1.4.2". You will be required to log in and register,

 but you can create an account on this page. After registration and

 accepting the Sun Community Source License, select "J2SESDK" and

 download the source file, j2sdk-1_4_2-bin-scsl.zip. Please place this file in

/usr/ports/distfiles. .*** Error code 1 Stop in /usr/ports/java/jdk14. *** Error code 1 Stop in /usr/ports/www/jakarta-tomcat5.

一樣說至http://www.sun.com/software/java2/download.html下載j2sdk-1_4_2-bin-scsl.zip(需要註冊資料才能下載)放到/usr/ports/distfiles再make install clean

 ===> Installing for jakarta-tomcat-5.0.25

 ===> jakarta-tomcat-5.0.25 depends on file: /usr/local/jdk1.4.2/bin/java - not found

 ===> Verifying install for /usr/local/jdk1.4.2/bin/java in /usr/ports/java/jdk14

 ===> jdk-1.4.2p6_4 :

 Because of licensing restrictions, you must fetch the source distribution

 manually. Please access http://www.sun.com/software/java2/download.html

 with a web browser and follow the "Download" link for the

 "Java(TM) SDK 1.4.2". You will be required to log in and register,

 but you can create an account on this page. After registration and

 accepting the Sun Community Source License, select "J2SESDK" and

 download the source file, j2sdk-1_4_2-src-scsl.zip. Please place this file in

 /usr/ports/distfiles.

 .*** Error code 1

 Stop in /usr/ports/java/jdk14.

 *** Error code 1

 Stop in /usr/ports/www/jakarta-tomcat5.

一樣說至http://www.sun.com/software/java2/download.html下載j2sdk-1_4_2-src-scsl.zip(已經註冊過就能下載啦)放到/usr/ports/distfiles再make install clean裝了好一陣子又出現如下錯誤訊息

 ===> Returning to build of jdk-1.4.2p6_4

 ===> jdk-1.4.2p6_4 depends on file: /usr/local/linux-sun-jdk1.4.2/bin/javac - not found

 ===> Verifying install for /usr/local/linux-sun-jdk1.4.2/bin/javac in /usr/ports/java/linux-sun-jdk14

 ===> linux-sun-jdk-1.4.2.05 You must manually fetch the J2SE SDK   self-extracting file for the Linux platform (j2sdk-1_4_2_05-linux-i586.bin)  from  http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=j2sdk-1.4.2_05-oth-JPR&SiteId=JSC&TransactionId=noreg,  place it in /usr/ports/distfiles and then run make again.

 *** Error code 1

 Stop in /usr/ports/java/linux-sun-jdk14.

 *** Error code 1

 Stop in /usr/ports/java/jdk14.

 *** Error code 1

 Stop in /usr/ports/www/jakarta-tomcat5.

一樣說至http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=j2sdk-1.4.2_05-oth- JPR&SiteId=JSC&TransactionId=noreg下載j2sdk-1_4_2_05-linux-i586.bin放到usr/ports/distfiles 再make install clean這一段將會跑非常的久@@安裝好出現如下訊息可知tomcat的安裝路徑、執行檔路徑、及一些Port Number

 ===> Patching for jakarta-tomcat-5.0.25

 Installation settings:

 Destination directory: /usr/local/jakarta-tomcat5.0

 Control program location: /usr/local/bin/tomcat50ctl

 Startup script location: /usr/local/etc/rc.d/020.jakarta-tomcat50.sh

 Location of JDK: /usr/local/linux-sun-jdk1.4.2

 Location of Java port: java/linux-sun-jdk14

 Running as (user/group): www/www

 HTTP port: 8180

 Shutdown listener port: 8005

 WARP port: 8008

 AJP 1.3 connector port: 8009

 Logfile stdout: /usr/local/jakarta-tomcat5.0/logs/stdout.log

 Logfile stderr: /usr/local/jakarta-tomcat5.0/logs/stderr.log

 Starting after install: NO

 Stop time-out: 5 sec.

Setp3.啟動Tomcat5

 #/usr/local/etc/rc.d/020.jakarta-tomcat50.sh start     //啟動方法一

 #/usr/local/bin/tomcat50ctl start                      //啟動方法二

確定tomcat是否有啟動

 #ps auxwww|grep java                         //查看執行序是否在run

 /usr/local/linux-sun-jdk1.4.2/bin/java -jar -Dcatalina.home=/usr/local/jakarta-tomcat5.0 bin/bootstrap.jar start

 #sockstat |grep java                         //查看相關port是否在run

 www java 6299 11 tcp4 *:8180 *:*     

Setp4.連結tomcat預設頁

http://your_ip:8180

http://www.ltesting.net/uploads/2007/06/8_200706091232581.jpg

【參考】

[FreeBSD 使用手冊-Linux 執行模式]

[The Jakarta Site - Apache Jakarta Tomcat]

【Log】

原文转自:http://www.ltesting.net