LoginSignup
33

More than 5 years have passed since last update.

さくらVPS(CentOS 6)にrbenvでRubyをインストール

Last updated at Posted at 2014-03-11

rbenvのインストール

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

ruby-buildのインストール

$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

opensslのインストール

opensslをインストールしていないとrubyインストール時にThe Ruby openssl extension was not compiled. Missing the OpenSSL lib?というエラーメッセージが出る。

$ sudo yum -y install openssl-devel

readlineのインストール

readlineがないとrails cとかpadrino cでエラーを吐く。

$ sudo yum -y install readline-devel

rubyのインストール

# インストールできるバージョンを確認
$ rbenv install --list
  ・・・
  2.0.0-p195
  2.0.0-p247
  2.0.0-p353
  2.0.0-p451
  2.0.0-preview1
  2.0.0-preview2
  2.0.0-rc1
  2.0.0-rc2
  2.1.0
  2.1.0-dev
  2.1.0-preview1
  2.1.0-preview2
  2.1.0-rc1
  2.1.1
  ・・・

# パッチを当てて、インストール
$ rbenv install 2.1.1
$ rbenv rehash

# 使用するrubyのバージョンの設定
$ rbenv global 2.1.1

.zshrcの編集

export PATH=$HOME/.rbenv/bin:$PATH
eval "$(rbenv init -)"
$ source ~/.zshrc

参照

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
33