LoginSignup
33
37

More than 5 years have passed since last update.

ubuntu + rbenvでrubyをインストール

Last updated at Posted at 2018-03-10

はじめに

ubuntu14.04、rbenvを使ったrubyのインストール手順を記載。

  • ubuntu 14.04
  • git
  • rbenv
  • ruby-build
  • ruby

gitのインストール

sudo apt-get -y install git

gitがインストールされたか確認

git --version

rbenvのインストール

gitからclone

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

.bash_profileに設定を追記

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

上記の設定を反映させるために再読み込み

exec $SHELL -l

rbenvがインストールされたか確認

rbenv -v

ruby-buildのインストール

ruby-buildとは、rubyをインストールするためのrbenvのプラグイン。
ruby-buildもgitからclone。

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

rubyのインストール

インストール可能なrubyのバージョンを確認

rbenv install --list

バージョンを指定してrubyをインストール&設定
(今回はバージョン2.4.0をインストール)

rbenv install 2.4.0
rbenv rehash
rbenv global 2.4.0

インストールされたかの確認は下記コマンド

rbenv versions
33
37
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
33
37