Tomcat5.0.18+Apache2.0.50+Linux9整合过程(完全版)
发表于:2007-06-08来源:作者:点击数:
标签:
Tomcat5.0.18+Apache2.0.50+ Linux 9整合过程(完全版) 李高峰 前言: 在《APACHE2.0.50+TOMCAT5.0.18+ LINUX 9配置过程》发表不久,许多朋友提出了诸多细节问题,为了满足大家的需要,作者以配置过程为主线,穿插必要的讲解,力求清晰完整,正文中粗黑体标
Tomcat5.0.18+Apache2.0.50+
Linux9整合过程(完全版)
李高峰
前言:
在《APACHE2.0.50+TOMCAT5.0.18+
LINUX9配置过程》发表不久,许多朋友提出了诸多细节问题,为了满足大家的需要,作者以配置过程为主线,穿插必要的讲解,力求清晰完整,正文中粗黑体标出的主要是操作命令,蓝体(除了URL以外)标出的是返回的结果,粗蓝体标出的是需要修改的地方和修改后的结果,欢迎大家提出意见。
假设您现在已经拥有了:
1. j2sdk-1_4_2_05-
linux-i586-rpm.bin
2. httpd-2.0.50.tar.gz
3. jakarta-tomcat-5.0.18.tar.gz
4. jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
并且放置在/www目录下。
[如果您没有这些安装包,您可以在网上查找,或者直接向我(lushanlee@hotmail.com)索取,注意版本号尽可能跟要求一致]
一、安装JDK
大家从网上
下载的JDK的LINUX版本一般是bin格式,要变成RPM格式必须通过转化(如果是RPM格式的文件直接就可以安装)。
1. 使bin文件可执行。
[root@localhost www]# chmod +x j2sdk-1_4_2_05-linux-i586-rpm.bin
2. 解压。
[root@localhost www]# ./j2sdk-1_4_2_05-linux-i586-rpm.bin
3. 直接安装,默认的安装路径是/usr/
java
[root@localhost www]# rpm -ivh j2sdk-1_4_2_05-linux-i586.rpm
4. 为了操作简单,有必要为刚刚安装的j2sdk1.4.2_05建立一个JDK的同步目录
[root@localhost java]# ln -s j2sdk1.4.2_05 jdk
5. 设置环境变量JAVA_HOME(这个变量会在后面的Tomcat中用到)。
[root@localhost java]# vi /etc/profile
在该文件的末尾加上下面两行
JAVA_HOME=/usr/java/jdk
export JAVA_HOME
保存退出
6. 验证该变量的设置。如果感觉安装顺利的话,可以跳过此步。
[root@localhost java]# echo $JAVA_HOME
大家会发现返回的是空行
不要惊慌,退出去重新登录系统就可以了
[root@localhost java]# exit
[root@localhost /]# echo $JAVA_HOME
/usr/java/jdk
如果返回这行,就说明设置成功。至此您的JDK安装完毕。
二、安装Tomcat
Tomcat的安装比较简单,解压后运行即可。
7. 将安装包拷贝到/usr/local目录下安装,如果您在/www目录下解开也可以,作者为了使目录规范,将其拷贝到/usr/local下安装。
[root@localhost www]# cp jakarta-tomcat-5.0.18.tar.gz /usr/local
[root@localhost local]# tar -zxvf jakarta-tomcat-5.0.18.tar.gz
8. 为解压后得到的jakarta-tomcat-5.0.18创建一个名为tomcat的同步目录。
[root@localhost local]# ln -s jakarta-tomcat-5.0.18 tomcat
9. 设置环境变量CATALINA_HOME,并验证
[root@localhost local]# vi /etc/profile
在文件最后加入如下两行
CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME
保存退出
验证CATALINA_HOME的过程跟上面验证JAVA_HOME的过程相同。
10. 启动并
测试安装结果
[root@localhost local]# cd ./tomcat/bin
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME: /usr/java/jdk
打开浏览器,敲入主机地址和端口号8080,回车
如:http://192.168.1.205:8080
如果出现如下画面则说明,安装成功。
三、安装Apache
相对以上两者来说,步骤较多,但具体每个步骤操作都很简单。
11. 拷贝安装包到/usr/local,并在目标目录下进行解压。
[root@localhost www]# cp httpd-2.0.50.tar.gz /usr/local
[root@localhost www]# cd /usr/local
[root@localhost local]# tar -zxvf httpd-2.0.50.tar.gz
12. 配置安装参数,安装的目标目录为/usr/local/apache2,一定要设置enable-mods-shared=all,否则在编译的时候会报错。
[root@localhost local]# cd httpd-2.0.50
[root@localhost httpd-2.0.50]# ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all
13. 编译并安装。
[root@localhost httpd-2.0.50]# make
[root@localhost httpd-2.0.50]# make install
14. 启动Apache,并测试。
[root@localhost httpd-2.0.50]# cd /usr/local/apache2/bin
[root@localhost bin]# ./apachectl start
打开浏览器,并在地址栏中输入主机的IP地址
如http://192.168.1.205
如果出现以下画面则说明安装成功。
四、生成连接器
15. 拷贝源包到/usr/local并在目标目录中解压(当然在原来的目录中解压也是可以的,作者是为了规范所以安装的程序都放在/usr/local下)。
[root@localhost www]# cp jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz /usr/local
[root@localhost www]# cd /usr/local
[root@localhost local]# tar -zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
16. 创建一个connector同步目录,目的是为了简化操作。
[root@localhost local]# ln -s jakarta-tomcat-connectors-jk2-2.0.4-src connector
17. 进行编译配置。大家一定要注意这几个参数中前三个是很重要的,必要时可以去相应的目录看看相关的文件是否存在。
[root@localhost local]# cd connector
[root@localhost native2]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-apr-lib=/usr/local/apache2/bin --with-tomcat-41=/usr/local/tomcat --with-java-home=/usr/java/jdk --with-jni
18. 修改Makefile文件,这个文件是编译生成连接器的关键,由于默认情况下会丢包所以有必要对其进行修改,关键!如果没有修改很可能会出现附录中的错误。
[root@localhost native2]# cd server/apache2
[root@localhost apache2]# vi Makefile
在其中很容易找到
###### Based on rules.mk ##########################################
将其前面的四行
ifdef APR_LIBDIR_LA
JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
else
JK_LDFLAGS=-lcrypt ${APR_LIBS}
endif
全都注释掉或删除掉,并在其下添加以下六行
ifdef APR_LIBDIR_LA
JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
else
JK_LDFLAGS=-lcrypt ${APR_LIBS} JK_LDFLAGS=-lcrypt ${APR_LIBS} -L/usr/local/apache2/lib -laprutil-0 -lgdbm -ldb-4.0 -lexpat
endif
结果如下
#ifdef APR_LIBDIR_LA
#JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
#else
#JK_LDFLAGS=-lcrypt ${APR_LIBS}
#endif
ifdef APR_LIBDIR_LA
JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
else
JK_LDFLAGS=-lcrypt ${APR_LIBS} JK_LDFLAGS=-lcrypt ${APR_LIBS} -L/usr/local/apache2/lib -laprutil-0 -lgdbm -ldb-4.0 -lexpat
endif
###### Based on rules.mk ##########################################
保存后退出。
19. 编译
[root@localhost apache2]# make
20. 运行apache下的apxs,如果返回如下结果,证明正常。
[root@localhost apache2]# cd ..
[root@localhost server]# cd ..
[root@localhost native2]# cd ../build/jk2/apache2
[root@localhost apache2]# /usr/local/apache2/bin/apxs -n jk2 -i mod_jk2.so
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' mod_jk2.so /usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp mod_jk2.so /usr/local/apache2/modules/
cp mod_jk2.so /usr/local/apache2/modules/mod_jk2.so
Warning! dlname not found in /usr/local/apache2/modules/mod_jk2.so.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache2/modules/mod_jk2.so
21. 拷贝生成的两个文件到apache的modules目录,这两个文件就是负责Tomcat和Apache通信的。
[root@localhost apache2]# cp libjkjni.so /usr/local/apache2/modules/jkjni.so
[root@localhost apache2]# cp mod_jk2.so /usr/local/apache2/modules/
cp: overwrite `/usr/local/apache2/modules/mod_jk2.so'? y
五 配置
22. 对Tomcat的jk2.properties进行配置,只需要修改一行,找到shm.file,去掉该行的注释符,并将路径改为/usr/local/apache2/logs/jk2.shm。
[root@localhost apache2]# cd /usr/local/tomcat/conf
[root@localhost conf]# vi jk2.properties
# channel
Unix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
shm.file=/usr/local/apache2/logs/jk2.shm
# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:
23. 配置Apache的httpd.conf,在LoadModule后添加一行,
LoadModule jk2_module modules/mod_jk2.so
在Apache启动的时候会装载mod_jk2.so
[root@localhost conf]# cd /usr/local/apache2/conf
[root@localhost conf]# vi httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule jk2_module modules/mod_jk2.so
24. 在Apache的conf目录中创建文件workers2.properties,其中加入如下几行
[root@localhost conf]# vi workers2.properties
其中可以添加Tomcat的虚拟目录
[uri:/jsp-examples/*]
当然也可以在其后添加
[uri:/servlets-examples/*]
这样你就可以访问servlets-examples
#------start ---------
[shm]
file=/usr/local/apache/logs/shm.file
size=1048576
[channel.socket:localhost:8009]
tomcatId=localhost:8009
[uri:/jsp-examples/*]
# --------end ------------
保存退出
25. 启动tomcat,apache并进行测试
[root@localhost conf]# cd /usr/local/tomcat/bin
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME: /usr/java/jdk
[root@localhost bin]# cd /usr/local/apache2/bin
[root@localhost bin]# ./apachectl start
打开浏览器,输入http://主机地址/ jsp-examples
如http://192.168.1.205/jsp-examples
附录一 联系方式
MSN:lushanlee@hotmail.com
QQ :180323536
Email: ligf@sports.cn
附录二 常见安装错误
1 在apache启动后的日志(/usr/loal/apache2/logs/error_log)里如果发现这样的错误:
channelSocket.open() connect failed localhost:8009 146 Connection refused
请检查workers2.properties配置是否正确
2 在TOMCAT启动后的日志(/usr/local/tomcat/logs/Catalina.out)里如果发现这样的错误:
INFO:APRnotloaded,disablingjnicomponents:java.io.IOException:java.lang.UnsatisfiedLinkError:/usr/local/apache2/modules/jkjni.so:/usr/local/apache2 /modules/jkjni.so: undefined symbol: apr_md5_final
请检查是否正确修改了Makefile
附录二 主要操作过程
一、安装JDK
[root@localhost www]# chmod +x j2sdk-1_4_2_05-linux-i586-rpm.bin
[root@localhost www]# ls
httpd-2.0.50.tar.gz
mysql-standard-4.1.3-beta-pc-linux-i686.tar.gz
j2sdk-1_4_2_05-linux-i586-rpm.bin
php-5.0.0.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz zlib-1.2.1.tar.gz
libxml2-2.6.11.tar.gz
[root@localhost www]# ./j2sdk-1_4_2_05-linux-i586-rpm.bin
Sun Microsystems, Inc.
Binary Code License Agreement
for the
JAVATM 2 SOFTWARE DEVELOPMENT KIT (J2SDK), STANDARD
EDITION, VERSION 1.4.2_X
SUN
MICROSYSTEMS, INC. ("SUN") IS WILLING TO LICENSE THE
SOFTWARE IDENTIFIED BELOW TO YOU ONLY UPON THE CONDITION
THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS BINARY
CODE LICENSE AGREEMENT AND SUPPLEMENTAL LICENSE TERMS
(COLLECTIVELY "AGREEMENT"). PLEASE READ THE AGREEMENT
CAREFULLY. BY DOWNLOADING OR INSTALLING THIS SOFTWARE, YOU
ACCEPT THE TERMS OF THE AGREEMENT. INDICATE ACCEPTANCE BY
SELECTING THE "ACCEPT" BUTTON AT THE BOTTOM OF THE
AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY ALL THE
TERMS, SELECT THE "DECLINE" BUTTON AT THE BOTTOM OF THE
AGREEMENT AND THE DOWNLOAD OR INSTALL PROCESS WILL NOT
CONTINUE.
。。。。。。。。。。
For inquiries please contact: Sun Microsystems, Inc., 4150
Network Circle, S
anta Clara, California 95054, U.S.A.
(LFI#140023/Form ID#011801)
Do you agree to the above license terms? [yes or no]
y
Unpacking...
Checksumming...
0
0
Extracting...
UnZipSFX 5.40 of 28 November 1998, by Info-ZIP (Zip-
Bugs@lists.wku.edu).
inflating: j2sdk-1_4_2_05-linux-i586.rpm
Done.
[root@localhost www]# ls
httpd-2.0.50.tar.gz libxml2-2.6.11.tar.gz
j2sdk-1_4_2_05-linux-i586.rpm mysql-standard-4.1.3-beta-pc-linux-i686.tar.gz
j2sdk-1_4_2_05-linux-i586-rpm.bin php-5.0.0.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz zlib-1.2.1.tar.gz
[root@localhost www]# rpm -ivh j2sdk-1_4_2_05-linux-i586.rpm
Preparing... ########################################### [100%]
1:j2sdk ########################################### [100%]
[root@localhost /]# cd /usr/java
[root@localhost java]# ls
j2sdk1.4.2_05
[root@localhost java]# ln -s j2sdk1.4.2_05 jdk
[root@localhost java]# ls
j2sdk1.4.2_05 jdk
[root@localhost java]# vi /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
unset pathmunge
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
JAVA_HOME=/usr/java/jdk
export JAVA_HOME
"/etc/profile" 51L, 883C written
[root@localhost java]# echo $JAVA_HOME
[root@localhost java]# exit
[root@localhost /]# echo $JAVA_HOME
/usr/java/jdk
二、安装Tomcat
[root@localhost /]# cd www
[root@localhost www]# ls
httpd-2.0.50.tar.gz libxml2-2.6.11.tar.gz
j2sdk-1_4_2_05-linux-i586.rpm mysql-standard-4.1.3-beta-pc-linux-i686.tar.gz
j2sdk-1_4_2_05-linux-i586-rpm.bin php-5.0.0.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz zlib-1.2.1.tar.gz
[root@localhost www]# cp jakarta-tomcat-5.0.18.tar.gz /usr/local
[root@localhost www]# cd /usr/local
[root@localhost local]# ls
bin etc games include jakarta-tomcat-5.0.18.tar.gz lib libexec man sbin share src
[root@localhost local]# tar -zxvf jakarta-tomcat-5.0.18.tar.gz
[root@localhost local]# ls
bin games jakarta-tomcat-5.0.18 lib man share
etc include jakarta-tomcat-5.0.18.tar.gz libexec sbin src
[root@localhost local]# ln -s jakarta-tomcat-5.0.18 tomcat
[root@localhost local]# ls
bin games jakarta-tomcat-5.0.18 lib man share tomcat
etc include jakarta-tomcat-5.0.18.tar.gz libexec sbin src
[root@localhost local]# vi /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
unset pathmunge
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
JAVA_HOME=/usr/java/jdk
export JAVA_HOME
CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME
[root@localhost local]# cd ./tomcat/bin
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME: /usr/java/jdk
三、安装Apache
[root@localhost www]# ls
httpd-2.0.50.tar.gz libxml2-2.6.11.tar.gz
j2sdk-1_4_2_05-linux-i586.rpm mysql-standard-4.1.3-beta-pc-linux-i686.tar.gz
j2sdk-1_4_2_05-linux-i586-rpm.bin php-5.0.0.tar.gz
jakarta-tomcat-5.0.18.tar.gz zlib-1.2.1.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
[root@localhost www]# cp httpd-2.0.50.tar.gz /usr/local
[root@localhost www]# cd /usr/local
[root@localhost local]# ls
bin httpd-2.0.50.tar.gz jakarta-tomcat-5.0.18.tar.gz man src
etc include lib sbin tomcat
games jakarta-tomcat-5.0.18 libexec share
[root@localhost local]# tar -zxvf httpd-2.0.50.tar.gz
httpd-2.0.50/test/.indent.pro
httpd-2.0.50/test/Makefile.in
httpd-2.0.50/test/README
httpd-2.0.50/test/check_chunked
httpd-2.0.50/test/cls.c
httpd-2.0.50/test/tcpdumpscii.txt
httpd-2.0.50/test/test-writev.c
httpd-2.0.50/test/test_find.c
httpd-2.0.50/test/test_limits.c
httpd-2.0.50/test/test_parser.c
httpd-2.0.50/test/test_select.c
httpd-2.0.50/test/time-sem.c
httpd-2.0.50/test/zb.c
httpd-2.0.50/configure
httpd-2.0.50/httpd.spec
[root@localhost local]# ls
bin httpd-2.0.50 jakarta-tomcat-5.0.18 libexec share
etc httpd-2.0.50.tar.gz jakarta-tomcat-5.0.18.tar.gz man src
games include lib sbin tomcat
[root@localhost local]# cd httpd-2.0.50
[root@localhost httpd-2.0.50]# ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all
[root@localhost httpd-2.0.50]# make
[root@localhost httpd-2.0.50]# make install
[root@localhost httpd-2.0.50]# cd /usr/local/apache2/bin
[root@localhost bin]# ls
ab apr-config apxs dbmmanage envvars-std htdigest httpd rotatelogs
apachectl apu-config checkgid envvars htdbm htpasswd logresolve
[root@localhost bin]# ./apachectl start
[root@localhost bin]# ./apachectl stop
四、生成连接器
[root@localhost www]# cp jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz /usr/local
[root@localhost www]# cd /usr/local
[root@localhost local]# ls
apache2 httpd-2.0.50 jakarta-tomcat-5.0.18.tar.gz man tomcat
bin httpd-2.0.50.tar.gz jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz sbin
etc include lib share
games jakarta-tomcat-5.0.18 libexec src
[root@localhost local]# tar -zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src/
jakarta-tomcat-connectors-jk2-2.0.4-src/xxx
jakarta-tomcat-connectors-jk2-2.0.4-src/README.txt
jakarta-tomcat-connectors-jk2-2.0.4-src/KEYS
jakarta-tomcat-connectors-jk2-2.0.4-src/LICENSE
。。。。。。。。
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/images/tomcat.ico
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk/
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk/aphowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk/domhowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk/iishowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk/neshowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk/quickhowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk/workershowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/confighowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/configtc.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/configt
clearcase/" target="_blank" >ccom.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/configtcex.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/configweb.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/configwebcom.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/configwebex.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/davhowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/installhowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/jk2/vhosthowto.xml
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/style.xsl
jakarta-tomcat-connectors-jk2-2.0.4-src/jk/xdocs/menu.idx
jakarta-tomcat-connectors-jk2-2.0.4-src/lib/
jakarta-tomcat-connectors-jk2-2.0.4-src/scandoc/
jakarta-tomcat-connectors-jk2-2.0.4-src/scandoc/scandoc.pl
jakarta-tomcat-connectors-jk2-2.0.4-src/scandoc/template.pl
[root@localhost local]# ls
apache2 httpd-2.0.50 jakarta-tomcat-5.0.18.tar.gz libexec src
bin httpd-2.0.50.tar.gz jakarta-tomcat-connectors-jk2-2.0.4-src man tomcat
etc include jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz sbin
games jakarta-tomcat-5.0.18 lib share
[root@localhost local]# ln -s jakarta-tomcat-connectors-jk2-2.0.4-src connector
[root@localhost local]# ls
apache2 games jakarta-tomcat-5.0.18 lib share
bin httpd-2.0.50 jakarta-tomcat-5.0.18.tar.gz libexec src
connector httpd-2.0.50.tar.gz jakarta-tomcat-connectors-jk2-2.0.4-src man tomcat
etc include jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz sbin
[root@localhost local]# cd connector
[root@localhost connector]# ls
build.properties.default common jk lib NOTICE RELEASE-NOTES.txt xxx
build.xml doc KEYS LICENSE README.txt scandoc
[root@localhost native2]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-apr-lib=/usr/local/apache2/bin --with-tomcat-41=/usr/local/tomcat --with-java-home=/usr/java/jdk --with-jni
。。。。。。
config.status: creating Makefile
config.status: creating server/apache13/Makefile
config.status: creating server/apache13/Makefile.apxs
config.status: creating server/apache2/Makefile
config.status: creating server/apache2/Makefile.apxs
config.status: creating ../build.properties
config.status: creating scripts/build/
unix/dummy
config.status: executing depfiles commands
[root@localhost native2]# cd server/apache2
[root@localhost apache2]# vi Makefile
# It doesn't hurt if we include all
INCLUDES= -I${JK_DIR}/include \
${APACHE2_INCL} \
${APR_INCL} \
${JAVA_INCL}
JK_CFLAGS=-DCHUNK_SIZE=4096 -DUSE_APACHE_MD5 -DHAVE_JNI
#ifdef APR_LIBDIR_LA
#JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
#else
#JK_LDFLAGS=-lcrypt ${APR_LIBS}
#endif
ifdef APR_LIBDIR_LA
JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
else
JK_LDFLAGS=-lcrypt ${APR_LIBS} JK_LDFLAGS=-lcrypt ${APR_LIBS} -L/usr/local/apache2/lib -laprutil-0 -lgdbm -ldb-4.0 -lexpat
endif
###### Based on rules.mk ##########################################
[root@localhost apache2]# make
[root@localhost apache2]# cd ..
[root@localhost server]# cd ..
[root@localhost native2]# cd ../build/jk2/apache2
[root@localhost apache2]# /usr/local/apache2/bin/apxs -n jk2 -i mod_jk2.so
/usr/local/apache2/build/instdso.sh SH_LIBTO='''/usr/local/apache2/build/libtl''' mod_jk2.so /usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp mod_jk2.so /usr/local/apache2/modules/
cp mod_jk2.so /usr/local/apache2/modules/mod_jk2.so
Warning! dlname not found in /usr/local/apache2/modules/mod_jk2.so.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache2/modules/mod_jk2.so
[root@localhost apache2]# cp libjkjni.so /usr/local/apache2/modules/jkjni.so
[root@localhost apache2]# cp mod_jk2.so /usr/local/apache2/modules/
cp: overwrite `/usr/local/apache2/modules/mod_jk2o'''? y
五、配置
[root@localhost apache2]# cd /usr/local/tomcat/conf
[root@localhost conf]# ls
Catalina catalina.properties server-minimal.xml tomcat-users.xml
catalina.policy jk2.properties server.xml web.xml
[root@localhost conf]# vi jk2.properties
# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# apr.jniModeSo=inprocess
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
shm.file=/usr/local/apache2/logs/jk2.shm
# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:
[root@localhost conf]# cd /usr/local/apache2/conf
[root@localhost conf]# vi httpd.conf
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs-2.0/> for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. Ty'''re here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# to be loaded here.
。。。。。。。
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule jk2_module modules/mod_jk2.so
[root@localhost conf]# ls
highperformance.conf httpd.conf magic ssl.conf
highperformance-std.conf httpd-std.conf mime.types ssl-std.conf
[root@localhost conf]# vi workers2.properties
#------start ---------
[shm]
file=/usr/local/apache/logs/shm.file
size=1048576
[channel.socket:localhost:8009]
tomcatId=localhost:8009
[uri:/jsp-examples/*]
# --------end ------------
~
~
[root@localhost conf]# cd /usr/local/tomcat/bin
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME: /usr/java/jdk
[root@localhost bin]# cd /usr/local/apache2/bin
[root@localhost bin]# ./apachectl start
skycao 回复于:2004-10-09 10:46:36
|
收藏啦!
|
dajun 回复于:2004-10-12 20:13:10
|
真是麻烦,
我想问问一个服务器的管理员,是不是应该把这些记在脑子里?
还是安装的时候参照这样的文档就可以?
我还在上学,以后想当个管理员,
如果可以不记 的话,我就不记(现在脑子不好使了)
如果非记 不可的话也没办法,可别到时候让人笑话
|
xsailor 回复于:2004-10-16 12:16:20
|
UP
学习ing....
|
wingger 回复于:2004-10-16 12:22:45
|
[quote:2a08163778="dajun"]真是麻烦,
我想问问一个服务器的管理员,是不是应该把这些记在脑子里?
还是安装的时候参照这样的文档就可以?
我还在上学,以后想当个管理员,
如果可以不记 的话,我就不记(现在脑子不好使了)
如果非?.........[/quote:2a08163778]
呵,不用啊,http.conf的注释很明白的
|
biolearner 回复于:2004-11-24 22:41:10
|
up!
|
wxfwxf 回复于:2005-02-19 11:22:23
|
楼主你好,我在fedora2上尝试按照你说的方法进行安装,但是到了验证JAVA_HOME时就显示为空行.重新启动都 没有用.我的J2SDK为j2sdk1.4.2_07 .请指出一条路.
|
挡泥板 回复于:2005-03-10 11:14:52
|
我在编译jakarta-tomcat-connectors-jk2-2.0.4的时候遇到一个错误:
configure: error: Apache 1.3 requires apr to built from source, use --with-apr and --with-apr-util
|
vulcan 回复于:2005-03-10 14:13:28
|
请问上面的高手,我是在fedora2下安装的,因为我以前安装时是完全安装,所以系统自带了APACHE,我曾试想把以前APACHE包卸掉,但是不能完全卸掉,是否有什么技巧可以完全卸掉,请指教!如果卸不掉,可以不管直接安装吗?
|
tanyear 回复于:2005-05-16 17:50:03
|
[quote:c97f1620b9="挡泥板"]我在编译jakarta-tomcat-connectors-jk2-2.0.4的时候遇到一个错误:
configure: error: Apache 1.3 requires apr to built from source, use --with-apr and --with-apr-util[/quote:c97f1620b9]
这个错误不是提示的很明显吗?需要装apr以及apr-util
装好之后记得
cd /usr/local/apache2/lib/
ln -s /usr/local/apr/lib/libapr-1.so.0.0.0 libapr-1.so
ln -s /usr/local/apr/lib/libapr-1.so.0.0.0 libapr-1.so.0
ln -s /usr/local/apr/lib/libaprutil-1.so.0.0.0 libaprutil-1.so
ln -s /usr/local/apr/lib/libaprutil-1.so.0.0.0 libaprutil-1.so.0
|
守夜人 回复于:2005-05-17 10:11:12
|
请教楼主,怎么配置才能使虚拟主机也能支持tomcat,我试了好久都不行!!!~~~
|
vulcan 回复于:2005-05-17 13:47:52
|
我也想知道!!!
|
vulcan 回复于:2005-05-18 10:41:02
|
[quote:4a505655f5="vulcan"]请问上面的高手,我是在fedora2下安装的,因为我以前安装时是完全安装,所以系统自带了APACHE,我曾试想把以前APACHE包卸掉,但是不能完全卸掉,是否有什么技巧可以完全卸掉,请指教!如果卸不掉,可以不管直接安装?..........[/quote:4a505655f5]
不用卸调,可以看本版精华区,有篇文章介绍了!
|
骑墙男人 回复于:2005-05-27 21:19:56
|
有任何疑问可以访问我的个人网站获取最新内容
http://sp.chinaident.com
|
>
原文转自:http://www.ltesting.net