Play framework のインストール
つい最近、Play frameworkを勉強のためにインストールしたのでまとめます。OSはCent OS 6.2です。
まず手始めに、open-jdk-1.7.0をダウンロードします。ダウンロードは必ず「-devel」をつけてデベロッパー用のを落としてください。そうしないとjavacが入っていないのでplayがうまく立ち上がりません。
1 |
# yum -y install java-1.7.0-openjdk-devel |
次に、公式ページから最新のPlay frameworkを任意の場所に落としてきます。KUJIRAは /usr/etc/配下に落としました。
ダウンロード方法はブラウザからのダウンロードでも「wget」でも何でも構いません。KUJIRAは「wget」でやります。ちなみに記事の投稿時の最新バージョンはPlay framework 2.1.1です。
1 |
# wget http://downloads.typesafe.com/play/2.1.1/play-2.1.1.zip |
ダウンロードが完了したら、解凍し展開します。
1 |
# unzip play-2.1.1.zip |
解凍が終わったら、フォルダに移動しパスを通します。
全体のパスを通すには/etc/profileファイルを編集します。
1 2 |
# cd play-2.1.1 # vim /etc/profile |
以下「/etc/profile」ファイル
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc # It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates. pathmunge () { ・ ・ ・ done unset i unset -f pathmunge <span style="color: #ff0000;">export PATH=$PATH:/usr/etc/play-2.1.1 <= 最終行に追加する。</span> |
ファイルへの追記が終わったら、システムにファイルの設定情報を読み込ませます。
1 |
# source /etc/profile |
これで設定が反映されたはずです。試しにplayコマンドを打ってみます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# play help _ _ _ __ | | __ _ _ _| | | '_ \| |/ _' | || |_| | __/|_|\____|\__ (_) |_| |__/ play! 2.1.1 (using Java 1.7.0_19 and Scala 2.10.0), http://www.playframework.org Welcome to Play 2.1.1! These commands are available: ----------------------------- license Display licensing informations. new [directory] Create a new Play application in the specified directory. You can also browse the complete documentation at http://www.playframework.org. |
と上記のような応答が返ってきたら設定は終了です。
通らない場合は、javacがちゃんとインストールされているか、また、playコマンドのパスがちゃんと通っているかを確認してください。
大体この二つをがクリアされて入ればよほどの設定をしていない限りうまくいくと思います。
それでは今日はここまで。