InstallRailsCentOS » 履歴 » バージョン 8
Yuumi Yoshida, 2016-03-01 23:16
| 1 | 6 | Yuumi Yoshida | # Ruby on Rails 開発環境の作り方 (CentOS 6.6) |
|---|---|---|---|
| 2 | 1 | Yuumi Yoshida | |
| 3 | 8 | Yuumi Yoshida | _2016/03/01更新_ |
| 4 | 1 | Yuumi Yoshida | |
| 5 | |||
| 6 | 6 | Yuumi Yoshida | ### 1. 必要なライブラリーのインストール |
| 7 | |||
| 8 | 1 | Yuumi Yoshida | 一行で入力して下さい |
| 9 | 6 | Yuumi Yoshida | |
| 10 | ~~~ |
||
| 11 | 3 | Yuumi Yoshida | $ sudo yum -y install git gcc gcc-c++ sqlite patch |
| 12 | 1 | Yuumi Yoshida | sqlite-devel zlib-devel openssl-devel libyaml-devel readline-devel libxml2-devel libxslt-devel libffi-devel |
| 13 | 6 | Yuumi Yoshida | ~~~ |
| 14 | 1 | Yuumi Yoshida | |
| 15 | 6 | Yuumi Yoshida | ### 2. rbenv のインストール |
| 16 | 1 | Yuumi Yoshida | |
| 17 | * rbenv, ruby-build のインストール |
||
| 18 | |||
| 19 | 6 | Yuumi Yoshida | ~~~ |
| 20 | 1 | Yuumi Yoshida | $ cd |
| 21 | $ git clone git://github.com/sstephenson/rbenv.git ~/.rbenv |
||
| 22 | $ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build |
||
| 23 | 6 | Yuumi Yoshida | ~~~ |
| 24 | 1 | Yuumi Yoshida | |
| 25 | |||
| 26 | * .bashrcの設定 |
||
| 27 | |||
| 28 | インストールが修了したら .bashrc の最後に以下の rbenvの起動スクリプトを追加します。 |
||
| 29 | |||
| 30 | 6 | Yuumi Yoshida | |
| 31 | ~~~ |
||
| 32 | 1 | Yuumi Yoshida | export PATH="$HOME/.rbenv/bin:$PATH" |
| 33 | eval "$(rbenv init -)" |
||
| 34 | 6 | Yuumi Yoshida | ~~~ |
| 35 | 1 | Yuumi Yoshida | |
| 36 | * 確認 |
||
| 37 | |||
| 38 | .bashrc変更後に以下を実行 |
||
| 39 | |||
| 40 | 6 | Yuumi Yoshida | |
| 41 | ~~~ |
||
| 42 | 1 | Yuumi Yoshida | $ source .bashrc |
| 43 | 6 | Yuumi Yoshida | ~~~ |
| 44 | 1 | Yuumi Yoshida | |
| 45 | ここで、rbenv install --list を実行し表示されたリストに中に2.1.0があれば OK |
||
| 46 | |||
| 47 | 6 | Yuumi Yoshida | |
| 48 | ~~~ |
||
| 49 | 1 | Yuumi Yoshida | $ rbenv install --list |
| 50 | Available versions: |
||
| 51 | 1.8.6-p383 |
||
| 52 | 1.8.6-p420 |
||
| 53 | |||
| 54 | ... |
||
| 55 | |||
| 56 | 7 | Yuumi Yoshida | 2.3.0 |
| 57 | 1 | Yuumi Yoshida | |
| 58 | ... |
||
| 59 | 6 | Yuumi Yoshida | ~~~ |
| 60 | 1 | Yuumi Yoshida | |
| 61 | |||
| 62 | 6 | Yuumi Yoshida | ### 3. Ruby のインストール |
| 63 | 1 | Yuumi Yoshida | |
| 64 | * インストールと設定 |
||
| 65 | |||
| 66 | 6 | Yuumi Yoshida | ~~~ |
| 67 | 7 | Yuumi Yoshida | $ rbenv install 2.3.0 |
| 68 | 1 | Yuumi Yoshida | $ rbenv rehash |
| 69 | 7 | Yuumi Yoshida | $ rbenv global 2.3.0 |
| 70 | 6 | Yuumi Yoshida | ~~~ |
| 71 | 1 | Yuumi Yoshida | |
| 72 | * 確認 |
||
| 73 | |||
| 74 | 7 | Yuumi Yoshida | ruby -v を実行し、 以下のように ruby 2.3.0 が表示されれば OK |
| 75 | 6 | Yuumi Yoshida | |
| 76 | ~~~ |
||
| 77 | 1 | Yuumi Yoshida | $ ruby -v |
| 78 | 7 | Yuumi Yoshida | ruby 2.3.0 ... |
| 79 | 6 | Yuumi Yoshida | ~~~ |
| 80 | 1 | Yuumi Yoshida | |
| 81 | |||
| 82 | |||
| 83 | 6 | Yuumi Yoshida | ### 4. Ruby on Rails のインストール |
| 84 | 1 | Yuumi Yoshida | |
| 85 | * gemコマンドのアップデート |
||
| 86 | |||
| 87 | 6 | Yuumi Yoshida | ~~~ |
| 88 | 1 | Yuumi Yoshida | $ gem update --system -N |
| 89 | 6 | Yuumi Yoshida | ~~~ |
| 90 | 1 | Yuumi Yoshida | |
| 91 | * インストール |
||
| 92 | |||
| 93 | 6 | Yuumi Yoshida | ~~~ |
| 94 | 1 | Yuumi Yoshida | $ gem install bundler -N |
| 95 | $ gem install rspec -N |
||
| 96 | $ gem install therubyracer -N |
||
| 97 | $ gem install rails -N |
||
| 98 | $ rbenv rehash |
||
| 99 | 6 | Yuumi Yoshida | ~~~ |
| 100 | 1 | Yuumi Yoshida | |
| 101 | * 確認 |
||
| 102 | |||
| 103 | rails -v を実行し、 以下のように Rails 4.2.3 が表示されれば OK |
||
| 104 | |||
| 105 | 6 | Yuumi Yoshida | |
| 106 | ~~~ |
||
| 107 | 1 | Yuumi Yoshida | $ rails -v |
| 108 | 7 | Yuumi Yoshida | Rails 4.2.5 |
| 109 | 6 | Yuumi Yoshida | ~~~ |
| 110 | 1 | Yuumi Yoshida | |
| 111 | 6 | Yuumi Yoshida | ### 5. 関連ライブラリーのインストール |
| 112 | 1 | Yuumi Yoshida | |
| 113 | Ruby on Railsでは初めてプロジェクトを作った際に関連するライブラリーがインストールされるので、一度ダミーのプロジェクトを作成します。 |
||
| 114 | |||
| 115 | 6 | Yuumi Yoshida | |
| 116 | ~~~ |
||
| 117 | 1 | Yuumi Yoshida | $ cd /tmp |
| 118 | $ rails new dummy |
||
| 119 | create |
||
| 120 | create README.rdoc |
||
| 121 | create Rakefile |
||
| 122 | |||
| 123 | ... |
||
| 124 | |||
| 125 | Your bundle is complete! |
||
| 126 | Use `bundle show [gemname]` to see where a bundled gem is installed. |
||
| 127 | 6 | Yuumi Yoshida | ~~~ |