日期:2014-05-16  浏览次数:20890 次

jdk+tomcat+apache安装 linux
jdk+tomcat+apache安装

默认分类   2009-06-16 16:50   阅读16   评论0   字号: 大大  中中  小小
以用户root身份安装。


su – root


1、java安装


在http://www.java.com下载jdk.

 chmod a+x j2sdk1_4_2_05-linux.bin

 ./j2sdk1_4_2_05-linux.bin

rpm -iv j2sdk1_4_2_05-linux.rpm

安装完毕后添加JAVA环境变量到/etc/profile:

JAVA_HOME=/usr/java/j2sdk1.4.2_05/

CLASSPATH=/usr/java/j2sdk1.4.2_05/jre/lib/rt.jar:.

PATH=$PATH:/usr/java/j2sdk1.4.2_05/bin

export JAVA_HOME CLASSPATH PATH

运行/etc/profile,并测试java是否可用

source /etc/profile

java -version


2、Tomcat安装


在http://www.apache.org下载tomcat

gunzip jakarta-tomcat-5.0.25.tar.gz

tar xvf jakarta-tomcat-5.0.25.tar

mv jakarta-tomcat-5.0.25 /usr/local/tomcat5.0.25

cd /usr/local/tomcat5.0.25/bin

./catalina.sh start

通过mozilla或firefox访问http://localhost:8080,测试tomcat的安装


3、apache安装



到http://www.apache.org下载apache

gunzip httpd-2.0.50.tar.gz

tar xvf httpd-2.0.50.tar

cd httpd-2.0.50/bin

./configure -prefix=/usr/local/apache2 -enable-so make

make install

cd /usr/local/apache2/conf

vi httpd.conf

更改:servername 你的机器ip或域名

group nobody

listen yourip:80 (apache2以后把port已经改成了listen)

保存后,cd ../bin

./apachectl start

通过mozilla或firefox访问http://localhost,测试apache的安装


4、整合apache2与tomcat5.0.25


用连接器jakarta-tomcat-connectors-jk2-src-current.tar.gz(就是jk2),大家可到http://jakarta.apache.org/site/sourceindex.cgi下载

gunzip jakarta-tomcat-connectors-jk2-src-current.tar.gz

tar xvf jakarta-tomcat-connectors-jk2-src-current.tar

cd jakarta-tomcat-connectors-jk2-src-current/jk/native2

./configure --with-apxs2=/usr/local/apache2/bin/apxs (注意改为你的apache安装目录)

make

cd ../build/jk2/apache2

/usr/local/apache2/bin/apxs -n jk2 -i mod_jk2.so

make

make install

编辑apache/conf/httpd.conf

LoadModule jk2_module modules/mod_jk2.so 保存

在apache/conf/中新建文件workers2.properties,内容为下(对其中具体内容根据自己实际情况给以修改):

[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

最后进入apache2的bin目录,运行apachectl

cd apache2/bin

./apachectl start