LoginSignup
2
2

More than 5 years have passed since last update.

Chefを使ってWebLogic Serverをサイレント・インストールしてみた

Last updated at Posted at 2016-06-10

概要

WebLogic Serverのサイレント・インストールするための準備をいくつか行いました。

それでは、実際にChefを使ってWebLogic Serverをサイレント・インストールしてみます。

サイレント・インストール

マニュアルでは次の箇所にサイレント・インストールについて記載があります。

マニュアルに記載あるようにサイレント・インストールを行う場合は、インストーラを起動する際に-silent -responseFileオプションを付けます。

構文は以下のようになります。

java -jar 製品JARファイル -silent -responseFile レスポンス・ファイルへのパス [-options] [(<CommandLinevariable=Value>)*]

製品JARファイル

WebLogic Serverのインストールイメージは私的使用として以下からダウンロードできます。
- Oracle Technology Network

以下のようにダウンロードできるDistributionが複数がありますが、今回はFusion Middleware Infrastructure Installer (fmw_12.2.1.0.0_infrastructure.jar)を使用しました。

  • Generic Installer for Oracle WebLogic Server and Oracle Coherence
  • Quick Installer intended for Oracle WebLogic Server and Oracle Coherence development only
  • Fusion Middleware Infrastructure Installer

インストール時のオプション

インストーラを起動する際に指定する主なオプションです。

オプション 説明
-silent サイレント・モードでインストーラを起動します。
指定がない場合は、グラフィカル・モードで起動します。
-help インストーラのヘルプを表示します。
-invPtrLoc ファイルへのパス Inventory Pointer Locationファイルの配置場所を指定します。
-responseFileファイルへのパス Response Fileの配置場所を指定します。
-logLevelレベル インストーラによって実行されるロギングのレベルを指定します。
severe
warning
info
config
fine
finer
finest
-debug デバッグ情報を表示します。
-noconsole メッセージを表示しません。

Chefを使ってやりたい事

Chefを使ってWebLogic Serverがインストールされていなければ、インストールを実施します。

今回作成するRecipe

  • WebLogic Server のサイレント・インストール実行
    • 「Response File」及び「oraInst.log」のパラメータ化

Recipe. WebLogic Serverのサイレント・インストール実施

以下の2種類のファイルを作成します。
- Recipe
- Attribute

Recipeでサイレント・インストールのコマンドを発行し、その時に使用するパラメータのデフォルト値をAttributeに記載します。

  • Attribute
attributes/default.rb
default['weblogic']['user'] = 'oracle'
default['weblogic']['group'] = 'oinstall'
default['weblogic']['java']['mx'] = '1024m'
default['weblogic']['mw_home'] = '/u01/app/oracle/product/fmw12.2.1'
default['weblogic']['wls_home'] = '/u01/app/oracle/product/fmw12.2.1/wlserver'
default['weblogic']['response_file_dir'] = '/root/responsefile'
default['weblogic']['response_file_install'] = '/root/responsefile/install_weblogic.rsp'
default['weblogic']['inventory_pointer_file'] = '/root/responsefile/oraInst.loc'
default['weblogic']['install_image'] = '/vagrant_data/wls1221/fmw_12.2.1.0.0_infrastructure.jar'

パラメータのデフォルト値を設定しています。

  • Recipe
recipes/install.rb
execute 'install weblogic server' do
  user node['weblogic']['user']
  group node['weblogic']['group']
  command "java -Xmx#{node['weblogic']['java']['mx']} -jar #{node['weblogic']['install_image']} -silent -responseFile #{node['weblogic']['response_file_install']} -invPtrLoc #{node['weblogic']['inventory_pointer_file']} 
  not_if { Dir.exist?("#{node['weblogic']['wls_home']}") }
end

以下の箇所でWebLogic Serverのインストール・ディレクトリの存在判定を行い、無ければサイレント・インストールを実行します。
rb
not_if { Dir.exist?("#{node['weblogic']['wls_home']}") }

Chefの実行イメージ

chef-install-weblogic.gif

まとめ

WebLogic Serverは、Javaアプリケーションの実行基盤というだけでなく、その他のオラクルのミドルウェア製品の基盤になります。そのため幾度となくインストールする機会が発生します。
そこでこのようにしてChefでインストールを自動化しておくと効率的に環境構築ができて便利です。

2
2
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
2
2