Chinaunix首页 | 论坛 | 博客
  • 博客访问: 94771
  • 博文数量: 42
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-16 13:39
文章分类

全部博文(42)

文章存档

2011年(1)

2010年(6)

2009年(35)

我的朋友

分类: LINUX

2009-12-08 15:55:08

系统软件环境:
Linux 2.4.21-4.EL
apr-1.1.1.tar.tar
apr-util-1.1.2.tar.tar
httpd-2.0.57.tar.tar
jakarta-tomcat-connectors-jk2-src-current.tar.tar
jakarta-tomcat-5.0.30.tar.gz
jdk-1_5_0_11-linux-i586-rpm.bin
libtool-1.5.6.tar.gz
服务器IP为172.16.11.86

为便于管理,上面除了jakarta-tomcat-5.0.30.tar.gz放在/usr/local/目录下外,其它所有软件包都放在/usr/local/src,纯属个人爱好
安装步骤
1、系统安装不用说,略

2、安装JDK1.5
[root@localhost src]# chmod +x jdk-1_5_0_11-linux-i586-rpm.bin
[root@localhost src]# ./jdk-1_5_0_11-linux-i586-rpm.bin
UnZipSFX 5.42 of 14 January 2001, by Info-ZIP ().
  inflating: jdk-1_5_0_11-linux-i586.rpm 
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
 
Done.
[root@localhost local]# vi /etc/profile
加入
JAVA_HOME=/usr/java/jdk1.5.0_11/
JRE_HOME=$JAVA_HOME/jre
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HOME/bin
export JAVA_HOME JRE_HOME PATH
[root@localhost local]# source /etc/profile
[root@localhost local]# java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharin


3、安装tomcat5.0.30
[root@localhost src]# mv jakarta-tomcat-5.0.30.tar.gz /usr/local/
[root@localhost local]# tar -zxvf jakarta-tomcat-5.0.30.tar.gz
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE:   /usr/local/jakarta-tomcat-5.0.30
Using CATALINA_HOME:   /usr/local/jakarta-tomcat-5.0.30
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-5.0.30/temp
Using JAVA_HOME:       /usr/java/jdk1.5.0_11/
[root@localhost bin]# ps -ef|grep tomcat
root     32051     1 39 20:12 pts/1    00:00:02 /usr/java/jdk1.5.0_11//bin/java -Djava.endorsed.dirs=/usr/local/jakarta-tomcat-5.0.30/common/endorsed -classpath /usr/java/jdk1.5.0_11//lib/tools.jar:/usr/local/jakarta-tomcat-5.0.30/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.30/bin/commons-logging-api.jar -Dcatalina
root     32093 21906  0 20:12 pts/1    00:00:00 grep tomcat
浏览器中打入,如果看到tomcat的欢迎画面,表示安装成功.


4、安装apr-1.1.1
[root@localhost src]# tar -zxvf apr-1.1.1.tar.tar
apr-1.1.1/libapr.rc
apr-1.1.1/build-outputs.mk
apr-1.1.1/apr.spec
[root@localhost apr-1.1.1]# ./configure
config.status: creating apr.pc
config.status: creating include/arch/unix/apr_private.h
config.status: executing default commands
[root@localhost apr-1.1.1]# make
gcc -E -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I./include -I/usr/local/src/apr-1.1.1/include/arch/unix -I./include/arch/unix -I/usr/local/src/apr-1.1.1/include  export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> apr.exp
make[1]: Leaving directory `/usr/local/src/apr-1.1.1'
[root@localhost apr-1.1.1]# make install
done
/usr/bin/install -c -m 644 build/apr_rules.out /usr/local/apr/build-1/apr_rules.mk
/usr/bin/install -c -m 755 apr-config.out /usr/local/apr/bin/apr-1-config

5、安装apr-util-1.1.2
[root@localhost src]# tar -zxvf apr-util-1.1.2.tar.tar
apr-util-1.1.2/build-outputs.mk
apr-util-1.1.2/libaprutil.rc
-zxvf apr-util-1.1.2.tar.tar
[root@localhost apr-util-1.1.2]# ./configure --with-apr=/usr/local/apr/
config.status: creating test/Makefile
config.status: creating include/private/apu_config.h
config.status: executing default commands
[root@localhost apr-util-1.1.2]# make
gcc -E -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   -I/usr/local/src/apr-util-1.1.2/include -I/usr/local/src/apr-util-1.1.2/include/private  -I/usr/local/apr/include/apr-1    export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> aprutil.exp
make[1]: Leaving directory `/usr/local/src/apr-util-1.1.2'
[root@localhost apr-util-1.1.2]# make install
/usr/bin/install -c -m 644 aprutil.exp /usr/local/apr/lib
/usr/bin/install -c -m 755 apu-config.out /usr/local/apr/bin/apu-1-config

6、安装httpd-2.0.57
[root@localhost src]# tar -zxvf httpd-2.0.57.tar.tar
httpd-2.0.57/acinclude.m4
httpd-2.0.57/Makefile.win
httpd-2.0.57/ABOUT_APACHE
httpd-2.0.57/configure
[root@localhost httpd-2.0.57]# ./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max --enable-so
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating include/ap_config_auto.h
config.status: executing default commands
[root@localhost httpd-2.0.57]# make
libprefork.la server/libmain.la os/unix/libos.la  /usr/local/src/httpd-2.0.57/srclib/pcre/libpcre.la /usr/local/src/httpd-2.0.57/srclib/apr-util/libaprutil-0.la -lexpat /usr/local/src/httpd-2.0.57/srclib/apr/libapr-0.la -lrt -lm -lcrypt -lnsl -lpthread -ldl
make[1]: Leaving directory `/usr/local/src/httpd-2.0.57'
[root@localhost httpd-2.0.57]# make install
mkdir /usr/local/apache/man/man8
mkdir /usr/local/apache/manual
Installing build system files
make[1]: Leaving directory `/usr/local/src/httpd-2.0.57'

7、安装jk2(最复杂的地方)注意红色报错
[root@localhost src]# tar -zxvf jakarta-tomcat-connectors-jk2-src-current.tar.tar
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 native2]# ./configure --with-apxs2=/usr/local/apache/bin/apxs
need to check for Perl first, apxs depends on it...
checking for perl... /usr/bin/perl
configure: error: can't locate libapr
处理方法:
[root@localhost lib]# pwd
/usr/local/apr/lib
[root@localhost lib]# ln -s /usr/local/apr/lib/libapr-1.so.0.1.1 /usr/local/apache/lib/libapr-1.so
[root@localhost lib]# ln -s /usr/local/apr/lib/libapr-1.so.0.1.1 /usr/local/apache/lib/libapr-1.so.0
[root@localhost lib]# ln -s /usr/local/apr/lib/libaprutil-1.so.0.1.1 /usr/local/apache/lib/libaprutil-1.so
[root@localhost lib]# ln -s /usr/local/apr/lib/libaprutil-1.so.0.1.1 /usr/local/apache/lib/libaprutil-1.so.0
[root@localhost native2]# ./configure --with-apxs2=/usr/local/apache/bin/apxs
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]# make
list=' server/apache2'; \
for i in $list; do \
        echo "Making $target in $i"; \
        if test "$i" != "."; then \
        (cd $i && make) || exit 1; \
fi; \
done;
Making  in server/apache2
make[1]: Entering directory `/usr/local/src/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2/server/apache2'
mkdir -p ../../../build/jk2/apache2/usr/local/apache/modules
/bin/sh /usr/local/apache/build/libtool --silent  --mode=compile gcc  -g -O2 -pthread    -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE   -I../../include -I/usr/local/apache/include -I/usr/local/src/httpd-2.0.57/srclib/apr-util/include -I/usr/local/src/httpd-2.0.57/srclib/apr/include   -DCHUNK_SIZE=4096 -DUSE_APACHE_MD5   -c ../../common/jk_channel.c -o ../../../build/jk2/apache2/jk_channel.lo
/usr/local/apache/build/libtool: /usr/local/apache/build/libtool: No such file or directory
make[1]: *** [../../../build/jk2/apache2/jk_channel.lo] Error 127
make[1]: Leaving directory `/usr/local/src/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2/server/apache2'
make: *** [jk2-build] Error 1
处理方法:
安装libtool-1.5.6
[root@localhost libtool-1.5.6]# ./configure
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
[root@localhost libtool-1.5.6]# make
make[1]: Entering directory `/usr/local/src/libtool-1.5.6/tests'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/src/libtool-1.5.6/tests'
[root@localhost libtool-1.5.6]# make install
make[2]: Leaving directory `/usr/local/src/libtool-1.5.6/tests'
make[1]: Leaving directory `/usr/local/src/libtool-1.5.6/tests'
[root@localhost build]# cd /usr/local/bin/
[root@localhost bin]# ln -s libtool /usr/local/apache/build/libtool
[root@localhost native2]# ./configure --with-apxs2=/usr/local/apache/bin/apxs
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]# make
libtool: install: warning: remember to run `libtool --finish /usr/local/apache/modules'
/bin/cp ../../../build/jk2/apache2//usr/local/apache/modules/mod_jk2.so ../../../build/jk2/apache2/mod_jk2.so
make[1]: Leaving directory `/usr/local/src/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2/server/apache2'
[root@localhost apache2]# pwd
/webapp/www/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/build/jk2/apache2
[root@localhost apache2]# cp mod_jk2.so /usr/local/apache/modules/      ---这一步骤一定要操作,否则,后面启动httpd时会报错

8、配置httpd和tomcat,开始整合,先保证httpd和tomcat都已经停掉
[root@localhost conf]# pwd
/usr/local/apache/conf
[root@localhost conf]# cp httpd.conf httpd.conf-bak           做任何配置前先进行备份,以便于后面的恢复
[root@localhost conf]# vi httpd.conf
找到如下三块地方
一、
DocumentRoot "/usr/local/apache/htdocs"
 
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#

Options None
AllowOverride None      ---》默认这里面是  Options FollowSymLinks
Order deny,Allow                           AllowOverride None
Allow from all

 


2、

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
#
# for more information.
#
    Options Indexes FollowSymLinks
 
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit Indexes
#
    AllowOverride None
 
#
# Controls who can get stuff from this server.
#
Order deny,allow
Allow from all            ---》默认这里面是Order allow,deny
XBitHack on                                Allow from all


3、
# Example:
# LoadModule foo_module modules/mod_foo.so
  LoadModule jk2_module modules/mod_jk2.so         ---》默认是没有这个的,自己添加


4、
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.jsp index.html.var    ---》默认是没有index.jsp的,自己添加的一个
注意:在网站上看到的资料,1那块还有一个
                                       Deny from all
                                      
        这样的内容,但是我的apache版本和其不一样,根目录下并没有WEB-INF,所以我也没去加那个


创建/usr/local/apache/conf/workers2.properties,内容如下:
[root@localhost conf]# pwd
/usr/local/apache/conf
[root@localhost conf]# vi workers2.properties
#---- worker2.properties
[logger.apache2]
level=DEBUG               ---日志级别
 
# Shared memory handling. Needs to be set.
[shm]
file=/usr/local/apache/logs/shm.file  
size=1048576              ---共享内存大小
 
# Example socket channel, explicitly set port and host.
[channel.socket:localhost:8009]
tomcatId=localhost:8009
port=8009
host=127.0.0.1
 
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
 
#[status:status]
# Uri mapping

#[uri:/jkstatus/*]
#group=status:status

#[uri:/jsp-examples/*]
#group=ajp13:localhost:8009

#[uri:/servlets-examples/*]
#group=ajp13:localhost:8009

#[uri:/javaapp/*]
#group=ajp13:localhost:8009

#[uri:*.jsp]
#worker=ajp13:localhost:8009

#[uri:10.0.0.10/*]
#worker=ajp13:localhost:8009

#[uri:/*.do]
#worker=ajp13:localhost:8009

[uri:/servlet/*]                         ---这里的意思是当apache遇到servlet请求时,将该文件解释工作转交给tomcat
worker=ajp13:localhost:8009

[uri:/*.jsp]                             ---这里的意思是当apache遇到jsp请求时,将该文件解释工作转交给tomcat
worker=ajp13:localhost:8009
#---- end of workers2.properties

修改/usr/local/jakarta-tomcat-5.0.30/conf/server.xml
[root@localhost conf]# pwd
/usr/local/jakarta-tomcat-5.0.30/conf
[root@localhost conf]# cp server.xml server.xml-bak
[root@localhost conf]# vi server.xml

 -->
             unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
              reloadable="true" crossContext="true"/>                           ---》默认红色部分是没有的,docBase一定要和根目录一样,除非有虚拟机主机
       

阅读(1084) | 评论(0) | 转发(0) |
0

上一篇:solaris10镜像

下一篇:apache+php+jsp+mysql整合

给主人留下些什么吧!~~