Tomcat5.0.18+Apache2.0.50+Linux9整合过程(完全版)之附录

发表于:2007-05-25来源:作者:点击数: 标签:
附录一 联系方式MSN:lushanlee@hotmail.comQQ :180323536Email: ligf@sports.cn附录二 常见安装错误1 在apache启动后的日志(/usr/loal/apache2/logs/error_log)里如果发现这样的错误:channelSocket.open() connect failed localhost:8009 146 Connectio
附录一 联系方式  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, 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=$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/configtclearcase/" 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_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 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. 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: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

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