This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#システム全体で利用できるようにrbenvをインストールするメモ | |
#CentOSにインストールすることを前提にしている | |
su - | |
#インストールに必要なものをインストール | |
yum install -y git gcc gcc-c++ openssl-devel readline-devel | |
#rbenvのインストール | |
cd /usr/local | |
git clone git://github.com/sstephenson/rbenv.git | |
#rbenvのpath設定 | |
echo 'export RBENV_ROOT="/usr/local/rbenv"' >> /etc/profile | |
echo 'export PATH="${RBENV_ROOT}/bin:${PATH}"' >> /etc/profile | |
echo 'eval "$(rbenv init -)"' >> /etc/profile | |
#pluginのインストール | |
mkdir /usr/local/rbenv/plugins | |
cd /usr/local/rbenv/plugins | |
#ruby-buildのインストール | |
git clone git://github.com/sstephenson/ruby-build.git | |
#rbenv-default-gemsのインストール | |
#ruby-buildでインストールした時にデフォルトで入れてくれるgemを設定できるようにする | |
git clone git://github.com/sstephenson/rbenv-default-gems.git | |
vi /usr/local/rbenv/default-gems | |
#デフォルトでインストールするgemを記載する | |
--------------------- | |
bundler | |
pry | |
--------------------- | |
#rbenv-gem-rehashのインストール | |
#gemをインストール or アンインストールした際に自動的にrbenv rehashを行うようにする | |
#いらないかもしれない | |
git clone https://github.com/sstephenson/rbenv-gem-rehash.git | |
#rbenv-updateのインストール | |
#rbenv updateと打てば rbenv & rbenvプラグインをまとめて最新の状態にするようにする | |
git clone https://github.com/rkh/rbenv-update.git | |
#rbenv-communal-gemsのインストール | |
#RubyのABI互換の単位でgemを共通に管理できるようにする | |
git clone git://github.com/tpope/rbenv-communal-gems.git | |
exit | |
#以下はrbenvの使い方メモ | |
su - | |
#rubyのインストール | |
#インストールできるものの確認 | |
rbenv install -l | |
#インストール(2.1.8の場合) | |
rbenv install 2.1.8 | |
#インストールされているversionの確認 | |
rbenv versions | |
--------------------------- | |
* system (set by /usr/local/rbenv/version) | |
2.1.8 | |
#全体で利用するバージョンを指定する | |
rbenv global 2.1.8 | |
#システムにインストールされているものをglobalにする場合は | |
rbenv global system | |
#あるディレクトリ以下で利用するversionの指定(どのユーザでも可能) | |
rbenv local 2.1.8 | |
#適用したversionの解除 | |
rbenv local --unset | |
#rbenvとpluginのアップデート | |
rbenv update |