rbenvをcloneする
$ cd ~/ $ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
環境設定
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc $ echo 'eval "$(rbenv init -)"' >> ~/.bashrc $ source ~/.bashrc
これでrbenvコマンドが使えます。
ruby-buildをclone
$ cd ~/ $ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rubyのversion一覧を取得
$ rbenv install --list
versionを指定してrubyをinstall
$ rbenv install -v 2.0.0-p451
下記のエラーが出た
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
OpenSSLが無いっておこられたのでinstall
$ sudo yum -y install openssl-devel
もう一回rubyをinstall
$ rbenv install -v 2.0.0-p451
使用するrubyのversionを指定
インストールされているversion一覧を表示
$ rbenv versions 2.0.0-p451
使用するrubyのversionを指定
$ rbenv global 2.0.0-p451
確認してみる
$ rbenv versions * 2.0.0-p451 (set by /home/vagrant/.rbenv/version)
rubyのversionを確認
$ ruby -v ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-linux]
これでrubyのversion管理が出来るようになりますた。