LoginSignup
2
2

More than 5 years have passed since last update.

CentOS 7にRuby 2.3.6をインストール

Posted at

(環境)

HW : raspberrypi2 model b
OS : CentOS 7.4
Ruby : 2.3.6

gitをインストールする

途中でgit cloneする為

$ su -
# yum install git

rbenvをインストール

rbenv(Simple Ruby Version Management)とはRubyのバージョンを簡単に切り替えられるコマンドラインツール

# git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
#echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
# echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
# source ~/.bash_profile

ruby-buildのインストール

ruby-buildはrbenvのプラグインでrbenv installが可能になる

# git clone git://github.com/sstephenson/ruby-build.git
# ~/.rbenv/plugins/ruby-build
# cd ~/.rbenv/plugins/ruby-build
# ./install.sh

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

rbenv install -l

ruby 2.3.6をインストールする

# rbenv install 2.3.6

インストール後

rubyのバージョンを特定できていないので下記のように表示される
# ruby -v
rbenv: ruby: command not found

The `ruby' command exists in these Ruby versions:
  2.3.6
globalでバージョンを指定する
# rbenv global 2.3.6

(参考)
https://qiita.com/Fendo181/items/d14ebfb148223c8e5ecb
https://qiita.com/Kaisyou/items/34ea9b5800434c1e09e6

2
2
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
2
2