0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ubuntu に wildfly 10をインストールした手順

Posted at

概要

ubuntuにとりあえずwildflyの10をservice登録してstandaloneで立ち上げるところまで。

環境

*** Version
ubuntu 14.04
Java 1.8.0_72
Wildfly 10.0.0.Final

Javaのインストール

# まずアップデート
sudo apt-get update

# add-apt-repositoryを使うためにインストール
sudo apt-get install software-properties-common

# リポジトリの追加
sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update

# Javaのインストール
sudo apt-get install oracle-java8-installer

wildflyインストールの準備

# ユーザ追加
sudo useradd -m wildfly

wildflyインストール

ここから先ほど作成したwildflyユーザで実施。

# ユーザ切換
sudo su wildfly

# 念のため移動
cd /home/wildfly

# tarballの取得
wget http://download.jboss.org/wildfly/10.0.0.Final/wildfly-10.0.0.Final.tar.gz

# 解凍
tar xvzf wildfly-10.0.0.Final.tar.gz

# シンボリックリンクを作っておく
ln -s wildfly-10.0.0.Final current

# /home/wildfly以下はこんな感じ
lrwxrwxrwx  1 wildfly wildfly        20 Feb  6 12:25 current -> wildfly-10.0.0.Final
drwxr-xr-x 10 wildfly wildfly      4096 Feb  6 12:09 wildfly-10.0.0.Final
-rw-rw-r--  1 wildfly wildfly 137189474 Jan 30 10:57 wildfly-10.0.0.Final.tar.gz

wildflyをサービスとして登録

ここからsudoersである必要があるので、wildflyユーザではないユーザで実施。

# 用意されたdebian用の起動スクリプトをコピー
sudo cp /home/wildfly/wildfly-10.0.0.Final/docs/contrib/scripts/init.d/wildfly-init-debian.sh /etc/init.d/wildfly

# 用意された初期設定ファイルのコピー
sudo cp /home/wildfly/wildfly-10.0.0.Final/docs/contrib/scripts/init.d/wildfly.conf /etc/default/wildfly

# 設定ファイルの修正 (修正内容は下に記載)
sudo vim /etc/default/wildfly

# ログ用ディレクトリの作成
sudo mkdir /var/log/wildfly
sudo chown wildfly:wildfly /var/log/wildfly

設定ファイルの修正内容は以下の通り。

 # General configuration for the init.d scripts,
 # not necessarily for JBoss AS itself.
 # default location: /etc/default/wildfly

 ## Location of JDK 
 # JAVA_HOME="/usr/lib/jvm/default-java"
 
 ## Location of WildFly
-# JBOSS_HOME="/opt/wildfly"
+JBOSS_HOME="/home/wildfly/current"
 
 ## The username who should own the process.
-# JBOSS_USER=wildfly
+JBOSS_USER=wildfly
 
 ## The mode WildFly should start, standalone or domain
-# JBOSS_MODE=standalone
+JBOSS_MODE=standalone
 
 ## Configuration for standalone mode
-# JBOSS_CONFIG=standalone.xml
+JBOSS_CONFIG=standalone.xml
 
 ## Configuration for domain mode
 # JBOSS_DOMAIN_CONFIG=domain.xml
 # JBOSS_HOST_CONFIG=host-master.xml
 
 ## The amount of time to wait for startup
-# STARTUP_WAIT=60
+STARTUP_WAIT=60
 
 ## The amount of time to wait for shutdown
-# SHUTDOWN_WAIT=60
+SHUTDOWN_WAIT=60
 
 ## Location to keep the console log
-# JBOSS_CONSOLE_LOG="/var/log/wildfly/console.log"
+JBOSS_CONSOLE_LOG="/var/log/wildfly/console.log"
 
 ## Additionals args to include in startup
-# JBOSS_OPTS="--admin-only -b 127.0.0.1"
+JBOSS_OPTS="-b 127.0.0.1"

起動

sudo service wildfly start

その他

8080はlocalhostのみにあけて、Webからのアクセスはnginxの80番経由で行うための設定ファイル。

$ cat /etc/nginx/conf.d/wildfly.conf
server {
    listen       80;

    proxy_set_header        Host $http_host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;
    add_header Cache-Control "no-cache, no-store";

    location / {
       proxy_pass http://127.0.0.1:8080;
    }
}
0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?