tomcat
# chmod 777 jdk-1_5_0_16-linux-i586.bin [root@teacher test]# ./jdk-1_5_0_16-linux-i586.bin 输入yes 回车# cp -a jdk1.5.0_16/ /usr/local/java
# vim /etc/profileJAVA_HOME=/usr/local/javaPATH=$JAVA_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOME PATH CLASSPATH# . /etc/profile 或重新登录
# java -version
java version "1.5.0_16"Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)安装tomcat
# tar zxvf apache-tomcat-6.0.16.tar.gz # cp -a apache-tomcat-6.0.16 /usr/local/tomcat# vim /etc/profileCATALINA_BASE=/usr/local/tomcat #设置tomcat工作目录CATALINA_HOME=/usr/local/tomcat #设置tomcat安装目录PATH=$CATALINA_HOME/bin:$PATHexport CATALINA_BASE CATALINA_HOME PATH写tomcat启动脚本
# vim /etc/init.d/tomcatd#!/bin/bashif [ $# -eq 1 ]then case "$1" in start) /usr/local/tomcat/bin/startup.sh ;; stop) /usr/local/tomcat/bin/shutdown.sh ;; restart) /usr/local/tomcat/bin/shutdown.sh /usr/local/tomcat/bin/startup.sh ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esacelse echo "Usage: $0 {start|stop|restart}" exit 1fi# chmod 777 /etc/init.d/tomcatd
# firefox 看到界面# netstat -altunp |grep :80查看80是否被别的网页服务器占用# cd /usr/local/tomcat/conf
# vim server.xml 67 <Connector port="80" protocol="HTTP/1.1"# vim tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?><tomcat-users><role rolename="manager"/><user username="tomcat" password="123456" roles="manager"/></tomcat-users>服务重启
/etc/init.d/tomcatd restart部署一个java论坛
# tar zxvf JiveForumsPro4_crack.tar.gz# cp -r jive/ /usr/local/tomcat/webapps/
安装mysql数据库
# yum install mysql-server mysql -y# /etc/init.d/mysqld start
# mysqladmin -u root password 123
# mysql -u root -p
mysql> grant all on jivedb.* to identified by "123456";
mysql> flush privileges;mysql> create database jivedb; # 创建论坛使用的数据库
# mysql jivedb -u root -p123< jive_forums_mysql.sql
安装连接mysql数据库的驱动 JDBC
# tar zxvf mysql-connector-java-3.1.14.tar.gz # cd mysql-connector-java-3.1.14# cp mysql-connector-java-3.1.14-bin.jar /usr/local/tomcat/lib/# /etc/init.d/tomcatd restart
# firefox &
Tomcat Manager ---> jive ----> 设置jiveHome路径: /usr/local/tomcat/webapps/jive/jiveHome, 按Set Jive Home --> 设置license,把LICENSE-2.0的内容全部复制到license文本框,save license。------------Database SettingsStandard Database Connection --->continue
-----------JDBC Presets: MySQLJDBC Driver Class: com.mysql.jdbc.DriverJDBC URL: jdbc:mysql://localhost:3306/jivedbUsername: jiveuserPassword: 123456 ---------User, Group and Authentication Systems default continue----------Other Settings continue------------Admin Account Setup skip this step--------------------# firefox 用帐户admin 密码admin 登录# firefox
-----------------------------------------------------
apache和tomcat整合# tar zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
# cp -a jakarta-tomcat-connectors-jk2-2.0.4-src /usr/local/tomcat-apache
# cd /usr/local/tomcat-apache/jk/native2
# ./configure --help
--with-apxs2=FILE location of apxs for Apache 2.0
# ./configure --with-apxs2=/usr/sbin/apxs
找不到apxs# yum provides "/usr/sbin/apxs"httpd-devel-2.2.3-43.el5.i386 : Development tools for the Apache HTTP server.# yum install httpd-devel -y
# ./configure --with-apxs2=/usr/sbin/apxs
# make# cd /usr/local/tomcat-apache/jk/build/jk2/apache2/
# cp mod_jk2.so /etc/httpd/modules/
这个模块就是apache和tomcat的连接器
# vim /etc/httpd/conf/httpd.conf
200 LoadModule jk2_module modules/mod_jk2.so # cd /usr/local/tomcat-apache/jk/conf# cp workers2.properties /etc/httpd/conf
# vim /etc/httpd/conf/workers2.properties
[uri:/jive/*]
info=map the tomcat[uri:/manager/*]info=map the tomcat[uri:/*.jsp]info=map the tomcat# cd /usr/local/tomcat/conf
# vim server.xml 67 <Connector port="8080" protocol="HTTP/1.1"重新启动tomcat
# /etc/init.d/tomcatd restart重新启动apache# /etc/init.d/httpd restart# cd /var/www/html
# mkdir test# echo "欢迎光临静态网页" > index.html# firefox //看到的是静态页面,由apache来处理
# firefox //看到的是动态页面,论坛
-------------------
# service httpd stop虚拟主机
# cd /usr/local/tomcat/conf# vim server.xml 67 <Connector port="80" protocol="HTTP/1.1"145 <Host name="" appBase="/usr/local/tomcat/test.com" // 是域名 /usr/local/tomcat/test.com是网页发布目录
146 unpackWARs="true" autoDeploy="true"147 xmlValidation="false" xmlNamespaceAware="false">148 </Host>