安装软件
$ sudo apt-get install sun-java5-jdk tomcat5.5 tomcat5.5-admin
安装后不需要手动设置JAVA_HOME的路径,因为在/etc/defalult/tomcat5.5文件中系统已经设置好了
JAVA_HOME=/usr/lib/jvm/java- 1.5.0 -sun
注意:如果tomcat处理的是
启动tomcat
$ sudo /etc/init.d/tomcat5.5 start
$ sudo /etc/init.d/tomcat5.5 stop
$ sudo /etc/init.d/tomcat5.5 restart
$ java -version
$ sudo nano /var/lib/tomcat5.5/conf/tomcat-users.xml
<?xml version='1.0' encoding='UTF-8'>
<tomcat-users>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="hiweed" password="HiPass" roles="admin,manager"/>
</tomcat-users>
$ sudo apt-get install libapache2-mod-jk
$ sudo nano /etc/libapache2-mod-jk/workers.properties
workers.tomcat_home=/usr/share/tomcat5.5
workers.java_home=/usr/lib/jvm/java- 1.5.0 -sun
ps=/
worker.list=worker1
worker.ajp13_worker.port=8180
worker.ajp13_worker.host=localhost
worker.ajp13_worker.type=ajp13
worker.ajp13_worker.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=ajp13_worker
$ sudo nano /etc/apache2/apache.conf
# 告诉JK到哪里去找workers.properties
JkWorkersFile /etc/libapache2-mod-jk/workers.properties
# 定义JK日志的位置
JkLogFile /var/log/apache2/mod_jk.log
# 设置JK日志的级别[debug/error/info]
JkLogLevel info
# 设置 Log 的格式
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JK 选项
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# 设置请求格式
JkRequestLogFormat "%w %V %T"
$ sudo nano /etc/apache2/sites-available/default
jkMount /* worker1
$ sudo /etc/init.d/apache2 restart
<Server port="8005" shutdown="SHUTDOWN">
文章整理来自于《Ubuntu Server最佳方案》书籍
由于字数限制,笔记可能无法全部上传,请下载笔记