VMware Linux下Tomcat安装与配置

 

 

首页服务器应用

背景:

阅读新闻

VMware Linux下Tomcat安装与配置

[日期:2011-11-24]   来源:Linux社区  作者:ethnicitybeta   [字体:]  

本次安装使用的套件

apache-tomcat-6.0.14.tar.gz
jdk-6u3-linux-i586-rpm.bin

httpd-2.2.6.tar.gz
tomcat-connectors-1.2.26-src.tar.gz

安装、设置的前期准备

(1)、安装编译套件gcc

(2)、关闭系统默认的apache

[root@localhost ~]# /etc/init.d/httpd stop
[root@localhost ~]# chkconfig httpd off


1、安装配置Java

[root@localhost ~]# chmod a+x jdk-6u3-linux-i586.rpm.bin

[root@localhost ~]# ./jdk-6u3-linux-i586.rpm.bin (按照提示输入yes)

[root@localhost ~]# cd /usr/java/jdk1.6.0_03/bin/
[root@localhost bin]# ./java(检查一下)

[root@localhost ~]# vi /etc/profile(修改环境变量)
export JAVA_HOME=/usr/java/jdk1.6.0_03
export JRE_HOME=/usr/java/jdk1.6.0_03/jre

[root@localhost ~]# echo $JAVA_HOME(退出当前shell再次登录能成功执行者两条指令表示成功)
/usr/java/jdk1.6.0_03
[root@localhost ~]# echo $JRE_HOME
/usr/java/jdk1.6.0_03/jre

2、安装httpd

[root@localhost ~]# tar zxvf httpd-2.2.6.tar.gz

[root@localhost ~]# cd httpd-2.2.6
[root@localhost httpd-2.2.6]# ./configure

[root@localhost httpd-2.2.6]# make

[root@localhost httpd-2.2.6]# make install

[root@localhost httpd-2.2.6]# cd /usr/local/apache2/bin/
[root@localhost bin]# ./apachectl start
[root@localhost bin]# netstat -tulnp|grep 80(确保80端口正常开启)

测试在浏览器地址栏中输入 出现 It Works! 字样表示成功
3、安装tomact

[root@localhost ~]# tar -zxvf apache-tomcat-6.0.14.tar.gz
[root@localhost ~]# mv ~/apache-tomcat-6.0.14 /usr/local/
[root@localhost ~]# cd /usr/local/apache-tomcat-6.0.14/bin/
[root@localhost bin]# ./startup.sh (开启服务)
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.14/temp
Using JRE_HOME:       /usr/java/jdk1.6.0_03/jre

[root@localhost bin]# netstat -tulnp|grep 8080(检查确保服务运行)
tcp        0      0 :::8080                     :::*                        LISTEN      8699/java 

测试在IE地址栏中输入:8080 出现带有小猫的页面表示成功

4、apache和tomcat的整合

[root@localhost ~]# tar zxvf tomcat-connectors-1.2.26-src.tar.gz

[root@localhost ~]# cd tomcat-connectors-1.2.26-src/native/

[root@localhost native]# ./configure --with-apxs=/usr/local/apache2/bin/apxs

[root@localhost native]#make

[root@localhost native]# cd apache-2.0/
[root@localhost apache-2.0]# cp mod_jk.so /usr/local/apache2/modules/

[root@localhost ~]# cd /usr/local/apache2/htdocs/
[root@localhost htdocs]# mkdir jsp/(建立此目录为了保存jsp文件)

[root@localhost htdocs]# cd jsp/(建立测试文档和目录)
[root@localhost jsp]# ll
total 16
-rw-r--r-- 1 root root 2065 Feb  2  2003 index.jsp
drwxr-xr-x 2 root root 4096 May 11 09:38 WEB-INFO
[root@localhost ~]# cd /usr/local/apache2/htdocs

[root@localhost htdocs]# ll
-rw-r--r-- 1 root root 2065 Feb  2  2003 index.jsp(建立测试主页)

[root@localhost ~]# cd /usr/local/apache2/conf
[root@localhost conf]# vim workers.properties (用户参数限定)
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300

[root@localhost conf]# vim mod_jk.conf (相关的用户日志文档、目录)
JkWorkersFile /usr/local/apache2/conf/workers.properties
JkLogFile /usr/local/apache2/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkMount /servlet/* worker1
JkMount /*.jsp worker1
[root@localhost ~]# cd /usr/local/apache2/conf/
[root@localhost conf]# vi httpd.conf (修改主配置档添加修改以下的部分)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ppzdy.html