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/profile
JAVA_HOME=/usr/local/java
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export 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/profile
CATALINA_BASE=/usr/local/tomcat #设置tomcat工作目录
CATALINA_HOME=/usr/local/tomcat #设置tomcat安装目录
PATH=$CATALINA_HOME/bin:$PATH
export CATALINA_BASE CATALINA_HOME PATH
写tomcat启动脚本
# vim /etc/init.d/tomcatd
#!/bin/bash
if [ $# -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
;;
esac
else
echo "Usage: $0 {start|stop|restart}"
exit 1
fi
# chmod 777 /etc/init.d/tomcatd
# firefox http://192.168.3.5:8080/
看到界面
# netstat -altunp |grep :80
查看80是否被别的网页服务器占用
# cd /usr/local/tomcat/conf # vim tomcat-users.xml 服务重启 部署一个java论坛 # cp -r jive/ /usr/local/tomcat/webapps/ 安装mysql数据库 # /etc/init.d/mysqld start # mysqladmin -u root password 123 # mysql -u root -p mysql> grant all on jivedb.* to jiveuser@localhost identified by "123456"; mysql> create database jivedb; # 创建论坛使用的数据库 # mysql jivedb -u root -p123< jive_forums_mysql.sql 安装连接mysql数据库的驱动 JDBC # /etc/init.d/tomcatd restart # firefox http://localhost & Standard Database Connection --->continue # firefox http://192.168.3.5/jive/index.jspa ----------------------------------------------------- # 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 # yum install httpd-devel -y # ./configure --with-apxs2=/usr/sbin/apxs # cd /usr/local/tomcat-apache/jk/build/jk2/apache2/ # cp mod_jk2.so /etc/httpd/modules/ 这个模块就是apache和tomcat的连接器 # vim /etc/httpd/conf/httpd.conf # cp workers2.properties /etc/httpd/conf # vim /etc/httpd/conf/workers2.properties [uri:/jive/*] # cd /usr/local/tomcat/conf 重新启动tomcat # cd /var/www/html # firefox http://192.168.3.5/test/ //看到的是静态页面,由apache来处理 # firefox http://192.168.3.5/jive/ //看到的是动态页面,论坛 ------------------- 虚拟主机 145
# vim server.xml
67
/etc/init.d/tomcatd restart
# tar zxvf JiveForumsPro4_crack.tar.gz
# yum install mysql-server mysql -y
mysql> flush privileges;
# 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/
Tomcat Manager ---> jive ----> 设置jiveHome路径: /usr/local/tomcat/webapps/jive/jiveHome, 按Set Jive Home --> 设置license,把LICENSE-2.0的内容全部复制到license文本框,save license。
------------
Database Settings
-----------
JDBC Presets: MySQL
JDBC Driver Class: com.mysql.jdbc.Driver
JDBC URL: jdbc:mysql://localhost:3306/jivedb
Username: jiveuser
Password: 123456
---------
User, Group and Authentication Systems
default continue
----------
Other Settings
continue
------------
Admin Account Setup skip this step
--------------------
# firefox http://192.168.3.5/jive/admin/
用帐户admin 密码admin 登录
apache和tomcat整合
找不到apxs
# yum provides "/usr/sbin/apxs"
httpd-devel-2.2.3-43.el5.i386 : Development tools for the Apache HTTP server.
# make
200 LoadModule jk2_module modules/mod_jk2.so
# cd /usr/local/tomcat-apache/jk/conf
info=map the tomcat
[uri:/manager/*]
info=map the tomcat
[uri:/*.jsp]
info=map the tomcat
# vim server.xml
67
# /etc/init.d/tomcatd restart
重新启动apache
# /etc/init.d/httpd restart
# mkdir test
# echo "欢迎光临静态网页" > index.html
# service httpd stop
# cd /usr/local/tomcat/conf
# vim server.xml
67
147 xmlValidation="false" xmlNamespaceAware="false">
148