本記事ではVagrantにRHEL(RedHat Enterprise Linux)をインストールを行い、その中にIBM MobileFirst Foundationの環境を構築するまでを説明する。なお、IBM MobileFirst Foundationは、IBMが提供するBluemix環境でも提供されているが、ここの説明想定ではローカル開発環境やそれぞれが管理するベアメタルサーバーに入れるものを想定している。
Vagrantのインストールについて
Vagrantは仮想マシンをシンプルにホストコンピュータの上に構築する仕組みです。
公式サイト
https://www.vagrantup.com
Vagrant のダウンロード
Vagrant - ダウンロードからそれぞれお使いのOS向けにバイナリが提供されているので、ダウンロードを行う。
ここではMacOS X(64bit)バージョンをダウンロードを行う。
Vagrant のインストール
ダウンロード後にダブルクリックにより、インストールを行う。
Vagrant の動作確認
それぞれお使いの環境でターミナルを立ち上げる(MacOSではCommand+SpaceでSpotlightを立ち上げ、> terminal と入力し、ターミナルを立ち上げる)
その後、以下のようにコマンドを入力し実行する。
$ vagrant -v
筆者環境では、次のように出る。
Vagrant 1.9.8
Oracle VM VirtualBoxのインストール
Vagrantを動かすにはVirtualBoxをインストールしてある必要がありますので、インストールを行います。
お使いのOSにあわせて、インストラクターのダウンロードおよびインストールを行ってください。
Vagrantboxesの一覧
パッケージのインストールはvagrantbox.es経由で取得し、仮想化マシンをVagrantに入れるのが一般的です。
今回はRHEL(RedHat Enterprise Linux)をインストールいたしますので、インストールするパッケージを選定しておきます。今回はRHEL7.3を選定いたしました。RHEL7.3のパッケージ名は[samdoran/rhel7]ですので、こちらは後ほど利用いたします。
Vagrant上のOSの環境構築
Vagrantの環境を整える
Vagrantの環境構築に必要なコマンドは以下のとおりです。
$ vagrant box add {name} % 新しいBOXを追加する
$ vagrant init {name} % BOXの初期化をする
$ vagrant up % 起動する
今回、RHEL7.3をインストールするために、terminalを起動し、次のようにコマンドを入力します。
$ cd ~
$ mkdir Vagrant && cd $_
$ mkdir RHEL && cd $_
$ vagrant box add samdoran/rhel7
実行結果は以下のとおりです。
vagrant box add samdoran/rhel7
==> box: Loading metadata for box 'samdoran/rhel7'
box: URL: https://vagrantcloud.com/samdoran/rhel7
==> box: Adding box 'samdoran/rhel7' (v1.0.2) for provider: virtualbox
box: Downloading: https://vagrantcloud.com/samdoran/boxes/rhel7/versions/1.0.2/providers/virtualbox.box
==> box: Successfully added box 'samdoran/rhel7' (v1.0.2) for 'virtualbox'!
IBM MobileFirst Foundation 8.0のダウンロード
IBM MobileFirst Foundation 8.0をダウンロードを行います。
[Developer Kit]の中の[Download the MobileFirst Developer Kit Installer for Linux]からインストーラーをダウンロードする。
mobilefirst-deved-devkit-linux-8.0.0.0.bin
Oracle Java SE Development Kit 8のダウンロード
JDK1.8をダウンロードします。
Java SE Development Kit 8u***から[Accept License Agreement]をチェックし、Linux x64用のrpmをダウンロードを行います。
Vagrant init
$ vagrant init samdoran/rhel7
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
# mkdir shared
$ vim Vagrantfile
# config.vm.synced_folder "../data", "/vagrant_data"
上記を次のように書き換える。
config.vm.synced_folder "./shared", "/home/vagrant/shared",owner:"vagrant",group:"vagrant"
とする。
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'samdoran/rhel7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'samdoran/rhel7' is up to date...
==> default: Setting the name of the VM: RHEL_default_1504878204702_89245
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
・・・・
・・・・
こちらを実行すると、vagrantの立ち上げが行えました。
立ち上げたVagrant環境にSSHで接続を行います。
$ vagrant ssh
こちらにて、Vagrant環境にログインできたことになります。
JDKのインストール
JDKのインストールを行う。
$ sudo rpm -ivh jdk-8u144-linux-x64.rpm
$ sudo sh shared/mobilefirst-deved-devkit-linux-8.0.0.0.bin
を実行すると
Preparing to install...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
Launching installer...
Graphical installers are not supported by the VM. The console mode will be used instead...
===============================================================================
IBM MobileFirst Foundation Developer Edition V8.0(created with InstallAnywhere)
-------------------------------------------------------------------------------
Preparing CONSOLE Mode Installation...
===============================================================================
Introduction
------------
InstallAnywhere will guide you through the installation of IBM MobileFirst
Foundation Developer Edition V8.0.
IMPORTANT: You may need to run the installer with admin privileges
It is strongly recommended that you quit all programs before continuing with
this installation.
Respond to each prompt to proceed to the next step in the installation. If
you want to change something on a previous step, type 'back'.
You may cancel this installation at any time by typing 'quit'.
PRESS <ENTER> TO CONTINUE:
===============================================================================
LICENSE INFORMATION
The Programs listed below are licensed under the following License
Information terms and conditions in addition to the Program license
terms previously agreed to by Client and IBM. If Client does not have
previously agreed to license terms in effect for the Program, the
International License Agreement for Non-Warranted Programs (Z125-5589-
05) applies.
Program Name: IBM MobileFirst Platform Foundation Developer Edition V8.
0
Program Number: Tool
Multi-Product Install Image
The Program is provided as part of a multi-product install image.
Licensee is authorized to install and use only the Program (and its
Supporting Programs, if any) for which a valid entitlement is obtained
and may not install or use any of the other software included in the
Press Enter to continue viewing the license agreement, or enter "1" to
accept the agreement, "2" to decline it, "3" to print it, "4" to read
non-IBM terms, or "99" to go back to the previous screen.:
ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
: /usr/local/MobileFirst-8.0.0.0
INSTALL FOLDER IS: /usr/local/MobileFirst-8.0.0.0
IS THIS CORRECT? (Y/N): Y
===============================================================================
Pre-Installation Summary
------------------------
Please Review the Following Before Continuing:
Product Name:
IBM MobileFirst Foundation Developer Edition V8.0
Install Folder:
/usr/local/MobileFirst-8.0.0.0
Required Disk Space:
783 MB
Available Disk Space:
47 GB
===============================================================================
Installing...
-------------
[==================|==================|==================|==================]
[------------------|------------------|------------------|------------------]
===============================================================================
Installation Complete
---------------------
The MobileFirst development kit has been installed to /usr/local/MobileFirst-8.
0.0.0.
To get started, navigate to this folder and execute the "run" script to start
MobileFirst Server, followed by the "console" script to open the MobileFirst
Operations Console.
From there you can begin to register and configure apps, as well as download
starter code and development tools.
のようになったら成功です。
※ところどころ、[Y]とキーボードから入力し、インストールの継続を行うことが必要です。
ホストOSからの確認
ホストOSのブラウザを立ち上げて、VagrantのゲストOS(RHEL)のIPアドレスとパスを以下のように入力をします。
http://192.168.33.10:9080/mfpconsole/index.html
すると、ID/PASSWORDを入力するように促されますので、admin/adminの組み合わせで入力し、ログインを行います。ログイン後、以下のような画面が現れます。