LoginSignup
11
11

More than 5 years have passed since last update.

Itamae | Itamae を使って Ubuntu 14.04 LTS 環境へ Ruby 2.1.3 , Rails 4.1.8 のインストール #itamae #ruby

Last updated at Posted at 2014-12-05

Itamae | Itamae を使って Ubuntu 14.04 LTS 環境へ Ruby 2.1.3 , Rails 4.1.8 のインストール #itamae #ruby

概要

Itamae を使って Ubuntu 14.04 LTS 環境へ Ruby 2.1.3 , Rails 4.1.8 のインストールします。

前提

  • Ubuntu 14.04 LTS install 済みのゲスト OS 環境 ( DockerHub の ubuntu:trusty イメージを利用 )
  • itamae インストール済みのホスト OS 環境

手順

Gemfile を生成します

$ bundle init

Gemfile を編集します

rutan さんの recipe をありがたく使わせていただきます。
itamae-plugin-recipe-rtn_rbenv

Gemfile
# A sample Gemfile
source "https://rubygems.org"

gem 'itamae-plugin-recipe-rtn_rbenv'

レシピを作成します

recipe.rb
execute 'apt-get update' do
  command 'apt-get update -y'
end

package "build-essential" do
  action :install
end

include_recipe 'rtn_rbenv::user'

node.json を作成 / 編集します

node.json
{
    "rtn_rbenv": {
        "user": "core",
        "versions": {
            "2.1.3": [
                {
                    "name": "bundler",
                    "version": "1.7.3",
                    "force": true
                },
                {
                    "name": "rails",
                    "version": "4.1.8",
                    "force": true
                }
            ]
        },
        "global": "2.1.3"
    }
}

公開レシピのインストール

$ bundle install

レシピを実行

  • まず、 dry-run ( -n オプション ) で確認
$ bundle exec itamae ssh -j node.json -i /path/to/your/key -h 172.17.8.101 -u core -n recipe.rb
  • 本実行
$ bundle exec itamae ssh -j node.json -i /path/to/your/key -h 172.17.8.101 -u core recipe.rb

インストール内容を確認

$ ssh core@172.17.8.101
$ ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
$ rails -v
Rails 4.1.8

Complete !

参照

itamae-plugin-recipe-rtn_rbenv

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