Subscribe:

2010/10/02

Tomcatインストール(さくらVPSサーバー)


JDKインストール

ファイルをダウンロード jdk-6u21-linux-i586-rpm.bin を使用 [root@centos]# sh jdk-6u21-linux-i586-rpm.bin Unpacking... Checksumming... Extracting... UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu). inflating: jdk-6u21-linux-i586.rpm inflating: sun-javadb-common-10.5.3-0.2.i386.rpm inflating: sun-javadb-core-10.5.3-0.2.i386.rpm inflating: sun-javadb-client-10.5.3-0.2.i386.rpm inflating: sun-javadb-demo-10.5.3-0.2.i386.rpm inflating: sun-javadb-docs-10.5.3-0.2.i386.rpm inflating: sun-javadb-javadoc-10.5.3-0.2.i386.rpm Preparing... ########################################### [100%] 1:jdk ########################################### [100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... tools.jar... localedata.jar... plugin.jar... javaws.jar... deploy.jar... Installing JavaDB Preparing... ########################################### [100%] 1:sun-javadb-common ########################################### [ 17%] 2:sun-javadb-core ########################################### [ 33%] 3:sun-javadb-client ########################################### [ 50%] 4:sun-javadb-demo ########################################### [ 67%] 5:sun-javadb-docs ########################################### [ 83%] 6:sun-javadb-javadoc ########################################### [100%] Java(TM) SE Development Kit 6 successfully installed. Product Registration is FREE and includes many benefits: * Notification of new versions, patches, and updates * Special offers on Sun products, services and training * Access to early releases and documentation Product and system data will be collected. If your configuration supports a browser, the Sun Product Registration form for the JDK will be presented. If you do not register, none of this information will be saved. You may also register your JDK later by opening the register.html file (located in the JDK installation directory) in a browser. For more information on what data Registration collects and how it is managed and used, see: http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html Press Enter to continue.....[Enter] Done. [root@centos]#

ApacheTomcatインストール

都合により5.5を使用 [root@centos]# wget http://ftp.kddilabs.jp/infosystems/apache//tomcat/tomcat-5/\ > v5.5.31/bin/apache-tomcat-5.5.31.tar.gz --2010-09-29 16:52:06-- http://ftp.kddilabs.jp/infosystems/apache//tomcat/tomcat-5/v5.5.31/bin/apache-tomcat-5.5.31.tar.gz Resolving ftp.kddilabs.jp... 192.26.91.193, 2001:200:601:10:206:5bff:fef0:466c Connecting to ftp.kddilabs.jp|192.26.91.193|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 8277017 (7.9M) [application/x-gzip] Saving to: `apache-tomcat-5.5.31.tar.gz' 100%[================================================>] 8,277,017 21.5M/s in 0.4s 2010-09-29 16:52:07 (21.5 MB/s) - `apache-tomcat-5.5.31.tar.gz' saved [8277017/8277017] [root@centos]# tar xzvf apache-tomcat-5.5.31.tar.gz 解凍 apache-tomcat-5.5.31/bin/catalina.sh apache-tomcat-5.5.31/bin/digest.sh apache-tomcat-5.5.31/bin/setclasspath.sh apache-tomcat-5.5.31/bin/shutdown.sh ~~~~ 中略 ~~~~( 全部で1014行 ) apache-tomcat-5.5.31/webapps/webdav/WEB-INF/web.xml apache-tomcat-5.5.31/webapps/webdav/index.html apache-tomcat-5.5.31/webapps/webdav/tomcat-power.gif apache-tomcat-5.5.31/webapps/webdav/tomcat.gif [root@centos]# mv apache-tomcat-5.5.31 /usr/local ファイル移動 [root@centos]# ln -s /usr/local/apache-tomcat-5.5.31 /usr/local/tomcat シンボリックリンクを貼る [root@centos]# vi /etc/profile.d/tomcat.sh export JAVA_HOME=/usr/java/default export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar export TOMCAT_HOME=/usr/local/tomcat export CATALINA_HOME=/usr/local/tomcat export CLASSPATH=$CLASSPATH:$CATALINA_HOME/common/lib :wq 上書き保存して終了 [root@centos]# vi /etc/init.d/tomcat Tomcat起動スクリプト作成 1 #!/bin/bash 2 # 3 # Startup script for the tomcat 4 # 5 # chkconfig: 345 80 15 6 # description: Tomcat is a Servlet+JSP Engine. 7 8 # Source function library. 9 . /etc/rc.d/init.d/functions 10 source /etc/profile.d/tomcat.sh 11 12 start(){ 13 if [ -z $(/sbin/pidof java) ]; then 14 echo "Starting tomcat" 15 /usr/local/tomcat/bin/startup.sh 16 touch /var/lock/subsys/tomcat 17 else 18 echo "tomcat allready running" 19 fi 20 } 21 22 stop(){ 23 if [ ! -z $(/sbin/pidof java) ]; then 24 echo "Shutting down tomcat" 25 /usr/local/tomcat/bin/shutdown.sh 26 until [ -z $(/sbin/pidof java) ]; do :; done 27 rm -f /var/lock/subsys/tomcat 28 else 29 echo "tomcat not running" 30 fi 31 } 32 33 case "$1" in 34 start) 35 start 36 ;; 37 stop) 38 stop 39 ;; 40 restart) 41 stop 42 start 43 ;; 44 status) 45 /usr/local/tomcat/bin/catalina.sh version 46 ;; 47 *) 48 echo "Usage: $0 {start|stop|restart|status}" 49 esac 50 51 exit 0 :wq 上書き保存して終了 [root@centos]# chmod +x /etc/init.d/tomcat Tomcat実行権限追加 [root@centos]# /etc/init.d/tomcat start Tomcat起動 Starting tomcat Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/default Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar [root@centos]# su - [root@ ~]# chkconfig --add tomcat Tomcatスクリプトを追加 [root@ ~]# chkconfig tomcat on 自動起動 [root@ ~]# chkconfig --list tomcat 自動起動を確認 tomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@ ~]# exit ブラウザから http://自分のアドレス:8080/ にアクセス Tomcatネコが表示されればとりあえず成功


0 件のコメント: