AS4下jdk+tomcat配置整合apache

操作系统:LINUX AS4
软件版本:
jdk-1_5_0_06-linux-i586.bin
httpd-2.2.4.tar.gz
jakarta-tomcat-5.0.27.tar.gz
jakarta-tomcat-connectors-jk2-src-current.tar.gz
1.jdk的安装
[root@localhost tja]# chmod +x jdk-1_5_0_06-linux-i586.bin
#给jdk1.5执行权限
[root@localhost tja]# ./jdk-1_5_0_06-linux-i586.bin
#bin文件可直接运行安装
[root@localhost tja]# mv jdk1.5.0_06 /usr/local/jdk
#把安装完的文件重命名为jdk并考贝至/usr/local/
[root@localhost tja]# vi /etc/profile
#编辑profile文件并添加环境变量,在此文件末尾处添加:
JAVA_HOME=/usr/local/jdk/
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:/lib.dt.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
存盘退出.
[root@localhost tja]# java -version
#查看当前java版本是否为1.5
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
如出现以上信息则为已正确安装上java.
2.apache的安装.
[root@localhost tja]# tar xzvf httpd-2.2.4.tar.gz
[root@localhost tja]# cd httpd-2.2.4
[root@localhost tja]# ./configure --prefix=/usr/local/apache2 --enable-so
[root@localhost httpd-2.2.4]# make && make install
#解开安装包编译安装目录,enable-so为加载jk2连接器,编译并安装
[root@localhost httpd-2.2.4]# /usr/local/apache/bin/apachectl start
#开始apache服务,并在客记端打开网页测试.
3.安装tomcat.
[root@localhost tja]# tar xzvf jakarta-tomcat-5.0.27.tar.gz
[root@localhost tja]# mv jakarta-tomcat-5.0.27 /usr/local/tomcat
#解开安装包既可直接使用,重命名为tomcat并复到/usr/local/下
[root@localhost tja]# /usr/local/tomcat/bin/startup.sh
#开始tomcat服务
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME: /usr/local/jdk/
如出现以上信息则为tomcat 已正常启动
客户端此时可打开IE并输入tomcat服务地址:8080,正常的话会出现tomcat的缺省页面,一只猫科动物.
[root@localhost tja]# /usr/local/tomcat/bin/shutdown.sh
#此为关闭tomcat服务
4.jk2的编译和加载
[root@localhost tja]# tar jakarta-tomcat-connectors-jk2-src-current.tar.gz
[root@localhost tja]# cd jakarta-tomcat-connectors-jk2-src-current/jk/native2
[root@localhost native2]#./configure --with-apxs2=/usr/local/apache/bin/apxs
[root@localhost native2]#make
#解开安装包进入到解开包目录中的/jk/native2下,编译,在make完之后,你会发现多了一个jakarta-tomcat-connectors-jk2-src-current/jk/build目录.
[root@localhost tja]# cd jakarta-tomcat-connectors-jk2-2.0.4-
src/jk/build/jk2/apache2/
[root@localhost apache2]#/usr/local/apache/bin/apxs -n jk2 -i mod_jk2.so
#进入到/build/jk2/apache2中并执行/usr/local/apache/bin/apxs -n jk2 -i mod_jk2.so,会在/usr/local/apache/modules中生成mod_jk2.so
[root@localhost tja]# ll /usr/local/apache/modules/
查看/uyr/local/apache/modules目录,你会发现已经生成一个名为
mod_jk2.so的文件了.
[root@localhost tja]# vi /usr/local/apache/conf/httpd.conf
#编辑httpd.conf文件,在末尾添加
LoadModule jk2_module modules/mod_jk2.so
存盘退出
[root@localhost tja]# vi /usr/local/apache/conf/workers2.properties
#在/usr/local/apache/conf目录中新建文件workers2.properties
内容如下:
[logger.apache2]
level=DEBUG
[shm]
file=/usr/local/apache2/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:/*]
worker=ajp13:localhost:8009
存盘退出
[root@localhost tja]# /usr/local/apache/bin/apachectl start
[root@localhost tja]# /usr/local/tomcat/bin/startup.sh
#启动apache,启动tomcat
在客户端找开IE访问192.168.1.121(本例中apache与tomcat服务器的地址),出现tomcat默认的猫科动物画面,然后访问,192.168.1.121:8080,依然是猫科动物的画面./
----文章转载于http://www.linuxdiyf.com/viewarticle.php?id=133520

你可能感兴趣的:(apache,jdk,tomcat,linux,IE)