Help us understand the problem. What is going on with this article?

CentOS6.7 + Java 1.8 + Tomcat 8 の環境を作るには

More than 3 years have passed since last update.

Javaの環境を早急に作る必要があったので、手順をまとめました
余計なことは無しに、簡単に構築する方法です。CentOSはminimalでインストールしましょう

■Oracle Javaが必要だったので、以下の方法でコマンドラインからダウンロードを実施、インストールする

cd /opt
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.rpm"
rpm -ivh jdk-8u65-linux-x64.rpm

■次にTomcat8のインストールを実行する

useradd -u 1000 tomcat8
cd /home/tomcat8/
wget http://ftp.riken.jp/net/apache/tomcat/tomcat-8/v8.0.30/bin/apache-tomcat-8.0.30.tar.gz
tar zxvf apache-tomcat-8.0.30.tar.gz
rm -rf apache-tomcat-8.0.30.tar.gz
cd apache-tomcat-8.0.30
mv * ../
cd ..
rm -rf apache-tomcat-8.0.30
cd /home
chown tomcat8:tomcat8 tomcat8 -R

■起動スクリプトを作る
vim /etc/rc.d/init.d/tomcat8

tomcat8
#!/bin/bash

# Tomcat8: Start/Stop Tomcat 8
#
# chkconfig: - 90 10
# description: Tomcat is a Java application Server.

. /etc/init.d/functions
. /etc/sysconfig/network

CATALINA_HOME=/home/tomcat8
TOMCAT_USER=tomcat8

LOCKFILE=/var/lock/subsys/tomcat8

RETVAL=0
start(){
    echo "Starting Tomcat8: "
    su - $TOMCAT_USER -c "$CATALINA_HOME/bin/startup.sh"
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch $LOCKFILE
    return $RETVAL
}

stop(){
    echo "Shutting down Tomcat8: "
    $CATALINA_HOME/bin/shutdown.sh
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
    return $RETVAL
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac
exit $?

chmod 777 /etc/rc.d/init.d/tomcat8
service tomcat8 start
chkconfig tomcat8 on

■後は、/home/tomcat8/webappsにデブロイすれば使えるはず

以上

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away