- 浏览: 222625 次
- 性别:
- 来自: 魔都
文章分类
最新评论
-
tsinglongwu:
顶,解决了获取Date单元格的内容问题,原来要转换成DateC ...
【转】JXL获取Excel单元格的日期(DateCell.getDate)与实际填写日期相差8小时的解决方法 -
alexyao8:
威武,今天刚遇到这个问题
【转】JXL获取Excel单元格的日期(DateCell.getDate)与实际填写日期相差8小时的解决方法 -
freeren:
...
利用JAVA Bean 反射得到set,get方法 -
pandengzhegt:
我也敬礼!
《Java Annotation 高级应用》 -
yingzhor:
好文! 敬礼!
《Java Annotation 高级应用》
李高峰
前言:在《APACHE2.0.50+TOMCAT5.0.18+LINUX9配置过程》发表不久,许多朋友提出了诸多细节问题,为了满足大家的需要,作者以配置过程为主线,穿插必要的讲解,力求清晰完整,正文中粗黑体标出的主要是操作命令,蓝体(除了URL以外)标出的是返回的结果,粗蓝体标出的是需要修改的地方和修改后的结果,欢迎大家提出意见。
假设您现在已经拥有了:
[如果您没有这些安装包,您可以在网上查找,或者直接向我(lushanlee@hotmail.com)索取,注意版本号尽可能跟要求一致]
一、安装JDK
大家从网上下载的JDK的LINUX版本一般是bin格式,要变成RPM格式必须通过转化(如果是RPM格式的文件直接就可以安装)。
1. 使bin文件可执行。
6. 验证该变量的设置。如果感觉安装顺利的话,可以跳过此步。
不要惊慌,退出去重新登录系统就可以了
二、安装TomcatTomcat的安装比较简单,解压后运行即可。
7. 将安装包拷贝到/usr/local目录下安装,如果您在/www目录下解开也可以,作者为了使目录规范,将其拷贝到/usr/local下安装。
验证CATALINA_HOME的过程跟上面验证JAVA_HOME的过程相同。
10. 启动并测试安装结果
如:http://192.168.1.205:8080
如果出现如下画面则说明,安装成功。
三、安装Apache相对以上两者来说,步骤较多,但具体每个步骤操作都很简单。
11. 拷贝安装包到/usr/local,并在目标目录下进行解压。
如http://192.168.1.205
如果出现以下画面则说明安装成功。
四、生成连接器
15. 拷贝源包到/usr/local并在目标目录中解压(当然在原来的目录中解压也是可以的,作者是为了规范所以安装的程序都放在/usr/local下)。
保存后退出。
19. 编译
五 配置[/b]22. 对Tomcat的jk2.properties进行配置,只需要修改一行,找到shm.file,去掉该行的注释符,并将路径改为/usr/local/apache2/logs/jk2.shm。
23. 配置Apache的httpd.conf,在LoadModule后添加一行,
LoadModule jk2_module modules/mod_jk2.so
在Apache启动的时候会装载mod_jk2.so
24. 在Apache的conf目录中创建文件workers2.properties,其中加入如下几行
25. 启动tomcat,apache并进行测试
如http://192.168.1.205/jsp-examples
附录 常见安装错误
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, Santa 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=$PATH1
else
PATH=$1PATH
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=$PATH1
else
PATH=$1PATH
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/configtccom.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_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
[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
五、配置
[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 ; for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They'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]
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
前言:在《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.bin2. 解压。
[root@localhost www]# ./j2sdk-1_4_2_05-linux-i586-rpm.bin3. 直接安装,默认的安装路径是/usr/java
[root@localhost www]# rpm -ivh j2sdk-1_4_2_05-linux-i586.rpm4. 为了操作简单,有必要为刚刚安装的j2sdk1.4.2_05建立一个JDK的同步目录
[root@localhost java]# ln -s j2sdk1.4.2_05 jdk5. 设置环境变量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安装完毕。
二、安装TomcatTomcat的安装比较简单,解压后运行即可。
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.gz8. 为解压后得到的jakarta-tomcat-5.0.18创建一个名为tomcat的同步目录。
[root@localhost local]# ln -s jakarta-tomcat-5.0.18 tomcat9. 设置环境变量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.gz12. 配置安装参数,安装的目标目录为/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=all13. 编译并安装。
[root@localhost httpd-2.0.50]# make [root@localhost httpd-2.0.50]# make install14. 启动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.gz16. 创建一个connector同步目录,目的是为了简化操作。
[root@localhost local]# ln -s jakarta-tomcat-connectors-jk2-2.0.4-src connector17. 进行编译配置。大家一定要注意这几个参数中前三个是很重要的,必要时可以去相应的目录看看相关的文件是否存在。
[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-jni18. 修改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]# make20. 运行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.so21. 拷贝生成的两个文件到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/ [b]cp: overwrite `/usr/local/apache2/modules/mod_jk2.so'? y
五 配置[/b]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 # 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:
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] 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
附录 常见安装错误
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, Santa 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=$PATH1
else
PATH=$1PATH
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=$PATH1
else
PATH=$1PATH
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/configtccom.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_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
[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
五、配置
[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 ; for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They'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]
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
发表评论
-
64 位JDK出现八小时时差解决方法
2012-02-27 15:22 2021发布的项目使用64位JDK,Java获取的时间总比正常的时候慢 ... -
Weblogic 部署 war包
2011-10-14 12:28 2087利用各种IDE工具, ... -
JBOSS 部署 war包
2011-10-14 12:05 115281、 安装 1.1、软件安装 首先要安装J ... -
【转】Apache、Tomcat、JBoss、WebLogic的区别与关系
2011-10-14 11:42 19846概述: Apache:全球应用最广泛的http服务器,免费, ... -
ORACLE 自动备份脚本
2011-09-13 12:02 1498方法一: 1. AP服务器上建立c:\backup文件夹(文件 ... -
Tomcat 启动报错:严重: IOException
2011-08-31 09:52 954Tomcat在启动时出现如下异常问题: ... -
Tomcat 集群分布式部署
2011-01-12 13:58 18271.软件环境准备 Apache: apache_2.2 ... -
Tomcat内存、连接数等性能参数设置
2011-01-08 13:55 980默认参数不适合生产环境使用,因此需要修改一些参数 1、 ... -
Tomcat集群和负载均衡的实现【session同步】
2010-08-30 09:39 904(一)环境说明 (1)服务器有4台,一台安装apache,三 ... -
Tomcat6.0的虚拟目录配置
2010-08-26 14:48 1314第一种就是直接把自己的项目复制到Tomcat的webapps目 ...
相关推荐
在本文中,我们将详细介绍如何在Windows XP环境下搭建一个基于Apache 2.2.3、PHP 5.2.0和MySQL 5.0.18的Web开发环境,并结合phpMyAdmin 2.7.0进行数据库管理。这个配置对于初学者来说是一个理想的起点,可以快速进入...
《深入解析Tomcat 5.0.18 ClassLoader源码》 在Java Web开发中,Tomcat作为一款广泛使用的应用服务器,其内部机制对于开发者来说具有极高的学习价值。尤其是Tomcat的ClassLoader机制,它是Java类加载的核心部分,...
根据提供的文件信息,本文将详细解析在Linux环境下配置PHP+MySQL+Apache的过程。这涉及到从安装到配置的各个步骤,并确保整个系统能够顺利运行。以下是详细的步骤分解。 ### 一、安装MySQL #### 1. 准备环境 首先...
Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目,由Apache、Sun 和其他一些公司及个人共同开发而成。由于有了Sun 的参与和支持,最新的Servlet 和JSP 规范总是能在...
《How Tomcat Works》是一本深入解析Apache Tomcat工作原理的专业书籍,中文版的提供使得国内读者无需语言障碍即可理解Tomcat的内部运作机制。这本书不仅涵盖了Tomcat的基础概念,还详细介绍了其核心组件和工作流程...
jakarta-tomcat-5.0.18.exe
1. 环境准备:需要有两台安装Windows 2008 R2操作系统的服务器,每台服务器需要安装JDK 1.6.20、Tomcat 5.0.18和Apache 2.2.3软件。两台服务器的IP地址分别为***.***.***.*和***.***.***.*,虚拟IP地址为***.***.***...
### How Tomcat Works(中文版) #### 一、引言 Tomcat作为一款免费且开源的Servlet容器,因其稳定性和可扩展性而受到广大开发者们的青睐。本文将深入剖析Tomcat的工作原理及其内部机制,帮助读者更好地理解这款...
这本书解剖了 Tomcat4.1.12 和 5.0.18 版本,解释 了它的 servlet 容器的内部运行机制,那是一个免费的,开源的,最受欢迎的 servlet 容器,代 号为 Catalina。Tomcat 是一个复杂的系统,由许多不同的组件构成。那些...
### Linux 下安装 MySQL 5.0.18(源码包)详解 #### 安装前准备 在开始安装 MySQL 5.0.18 的源码包之前,需要确保你的 Linux 系统已安装了必要的编译工具,如 GCC 和其他依赖库。通常情况下,可以通过以下命令来...
MySQL 5.0.18 是 MySQL 数据库管理系统的一个历史版本。MySQL 是一款开源、免费的关系型数据库管理系统,广泛应用于互联网行业中,特别是网站和应用程序的数据存储。它的特点是速度快、稳定性好、易于使用,并且支持...