浏览 4507 次
锁定老帖子 主题:ubuntu jdk tomcat安装
精华帖 (1) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (2)
|
|
---|---|
作者 | 正文 |
发表时间:2009-10-08
chmod a+x jdk-6u16-linux-i586.bin sudo cp jdk-6u16-linux-i586.bin /usr/local/ cd /usr/local/ sudo /usr/local/jdk-6u16-linux-i586.bin sudo rm -f /usr/local/jdk-6u16-linux-i586.bin 设置环境变量 sudo vi /etc/profile 输入以下: export JAVA_HOME=/usr/local/jdk1.6.0_16 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH 重启系统 (也可以不用重启系统先logout然后login) 查看java版本: java –version Tomcat安装 tar zxvf apache-tomcat-6.0.20.tar.gz sudo cp -rf apache-tomcat-6.0.20 /home/workhome/tomcat6 添加运行tomcat用户(权限可能有问题,测试ing) sudo useradd -d /home/workhome/tomcat6 -s /usr/sbin/nologin tomcat sudo chown -R ftp:ftp /home/workhome/tomcat6 sudo chown -R tomcat /home/workhome/tomcat6/conf sudo chown -R tomcat /home/workhome/tomcat6/logs sudo chown -R tomcat /home/workhome/tomcat6/work sudo chown -R tomcat /home/workhome/tomcat6/webapps/* 安装启动脚本 cd /home/workhome/tomcat6/bin/ sudo tar zxvf jsvc.tar.gz cd jsvc-src/ sudo sh support/buildconf.sh # support/buildconf.sh: configure script generated successfully sudo ./configure --with-java=/usr/local/jdk1.6.0_16 sudo make sudo cp /home/workhome/tomcat6/bin/jsvc-src/native/Tomcat5.sh /etc/init.d/tomcat6 sudo chmod 755 /etc/init.d/tomcat6 编辑启动脚本 sudo vi /etc/init.d/tomcat6 更改以下: #!/bin/sh ############################################################################## # # Copyright 2004 The Apache Software Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################## # # Small shell script to show how to start/stop Tomcat using jsvc # If you want to have Tomcat running on port 80 please modify the server.xml # file: # # <!-- Define a non-SSL HTTP/1.1 Connector on port 80 --> # <Connector className="org.apache.catalina.connector.http.HttpConnector" # port="80" minProcessors="5" maxProcessors="75" # enableLookups="true" redirectPort="8443" # acceptCount="10" debug="0" connectionTimeout="60000"/> # # That is for Tomcat-5.0.x (Apache Tomcat/5.0) # # Adapt the following lines to your configuration JAVA_HOME=/usr/local/jdk1.6.0_16 CATALINA_HOME=/home/workhome/tomcat6 DAEMON_HOME=/home/workhome/tomcat6/bin TOMCAT_USER=tomcat # for multi instances adapt those lines. TMP_DIR=/var/tmp PID_FILE=/var/run/jsvc.pid CATALINA_BASE=/home/workhome/tomcat6 #CATALINA_OPTS="-Djava.library.path=/home/jfclere/jakarta-tomcat-connectors/jni/native/.libs" CATALINA_OPTS='-Xms64m -Xmx256m' CLASSPATH=\ $JAVA_HOME/lib/tools.jar:\ $CATALINA_HOME/bin/commons-daemon.jar:\ $CATALINA_HOME/bin/bootstrap.jar case "$1" in start) # # Start Tomcat # $DAEMON_HOME/jsvc-src/jsvc \ -user $TOMCAT_USER \ -home $JAVA_HOME \ -Dcatalina.home=$CATALINA_HOME \ -Dcatalina.base=$CATALINA_BASE \ -Djava.io.tmpdir=$TMP_DIR \ -wait 10 \ -pidfile $PID_FILE \ -outfile $CATALINA_HOME/logs/catalina.out \ -errfile '&1' \ $CATALINA_OPTS \ -cp $CLASSPATH \ org.apache.catalina.startup.Bootstrap # # To get a verbose JVM #-verbose \ # To get a debug of jsvc. #-debug \ exit $? ;; stop) # # Stop Tomcat # $DAEMON_HOME/jsvc-src/jsvc \ -stop \ -pidfile $PID_FILE \ org.apache.catalina.startup.Bootstrap exit $? ;; *) echo "Usage tomcat.sh start/stop" exit 1;; esac 建立管理用户: sudo vi /home/workhome/tomcat6/conf/tomcat-users.xml <role rolename="manager"/> <user username="sendstomcat" password="hquxmlab6161788" roles="manager"/> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |