RedHat AS5 Apache2.2.9 Tomcat5.0.30 JK2 JDK1.5 配置
记录一下配置过程,遇到很多问题。配置完成了,不懂的地方还是很多,继续学习。
软件环境
-----------------------------------------------------------------------------------------------
RedHat Enterprise Linux 5 Linux 2.6.18-8.el5
httpd-2.2.9.tar.gz
jakarta-tomcat-5.0.30.tar.gz
jdk-1_5_0_16-linux-i586-rpm.bin
jakarta-tomcat-connectors-jk2-src-current.tar.gz 连接器
-----------------------------------------------------------------------------------------------
安装JDK
#chmod a+x jdk-1_5_0_16-linux-i586-rpm.bin
#./jdk-1_5_0_16-linux-i586-rpm.bin
#tar zxvf jdk-1_5_0_16-linux-i586-rpm
安装完成后 默认路径 /usr/java/jdk-1_5_0_16
-----------------------------------------------------------------------------------------------
安装Tomcat5.0.30
#tar.zxvf jakarta-tomcat-5.0.30.tar.gz
#cp jakarta-tomcat-5.0.30 /usr/local/tomcat5
设置环境变量
#vi /etc/profile
export PATH=$JAVA_HOME/bin:$PATH:$CATALINA_HOME/bin:/usr/bin
export JAVA_HOME=/usr/java/jdk1.5.0_16
export CATALINA_HOME=/usr/local/tomcat5
启动Tomcat
#/usr/local/tomcat5/bin/startup.sh
http://localhost:8080
-----------------------------------------------------------------------------------------------
安装Apache2.2.9
安装之前系统自带的有一个apache2.2.3 ,就想把它删除掉................(神经啊!)
下载和系统自带的apache一样的包 apache2.2.3 编译
#tar zxvf httpd-2.2.3.tar.gz
#./configure --prefix=/usr/local/apache2 --enable-module=most --enable-shared=most --enable-so
#make
出现错误
opt.c && touch sockopt.lo
sockopt.c: In function 'apr_socket_opt_set':
sockopt.c:254: error: 'SCTP_NODELAY' undeclared (first use in this function)
sockopt.c:254: error: (Each undeclared identifier is reported only once
sockopt.c:254: error: for each function it appears in.)
make[4]: *** [sockopt.lo] 错误 1
make[4]: Leaving directory `/home/13angel/Desktop/httpd-2.0.46/srclib/apr/network_io/unix'
make[3]: *** [all-recursive] 错误 1
make[3]: Leaving directory `/home/13angel/Desktop/httpd-2.0.46/srclib/apr/network_io/unix'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/home/13angel/Desktop/httpd-2.0.46/srclib/apr'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/13angel/Desktop/httpd-2.0.46/srclib'
make: *** [all-recursive] 错误 1
! 这是什么错误,昏死
google 找到一个答案,但还不知道是为什么。
vi srclib/apr/include/apr.h
#define APR_HAVE_SCTP 1
把1变为0
保存退出
再次编译才可以通过了。
删除系统的apache
#rpm -e --nodeps --noscripts httpd-2.2.3-6.el5.i386
删掉了系统的apache
安装下载的apache
#tar zxvf httpd-2.2.9.tar.gz
#./configure --prefix=/usr/local/apache2 --enable-module=most --enable-shared=most --enable-so
#make
#make install
启动Apache
/usr/local/apache2/bin/apachectl start
-----------------------------------------------------------------------------------------------
编译JK2
#tar.zxvf jakarta-tomcat-connectors-jk2-src-current.tar.gz
#cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2
#./buildconf.sh
#./configure --with-apxs2=/usr/local/apache2/bin/apxs
出错-------
no apxs
need to check for Perl first, apxs depends on it...
checking for perl... /usr/bin/perl
configure: error: can't locate libapr
但是 apr-1.0.1 apr-util-1.0.1 libtool 都已经安装了啊
apr-1.2.7-11 apr-util-1.2.7-6 libtool-1.5.22-6.1 (难道版本要更新?)
不知道为什么
没有管
make
#make
生成mod_jk2.so
到../build/jk2/apache2/
#cp mod_jk2.so /usr/local/apache2/modules/
路径 /usr/local/apache2/conf
编辑 workers2.properties
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
tomcatId=localhost:8009
# Map the Tomcat examples webapp to the Web server uri space
[uri:/jsp-examples/*]
info=Map the tomcat webapp of /jsp-examples/
[uri:/servlets-examples/*]
info=Map the tomcat webapp of /servlets-examples/
# Define the log file location and file size
[shm]
file=/usr/local/apache2/logs/shm.file
size=1048576
编辑 httpd.conf
LoadModule jk2_module modules/mod_jk2.so
DirectoryIndex index.htm index.jsp index.html
启动Apache Tomcat
http://192.168.11.4/servlets-examples/
能正确看到页面 但很多地方还不是很清楚,学习中。