Catalogue
Installing Ruby on CentOS 7

Installing Ruby on CentOS 7

🌐 日本語で読む

Environment

  • AWS
  • CentOS Linux release 7.0.1406 (Core)

Install required modules

1
$ sudo yum -y install git libffi libffi-dev gcc openssl-devel readline-devel zlib-devel

Download rbenv and ruby-build

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

Set the rbenv PATH

1
2
3
4
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ exec $SHELL
$ source ~/.bash_profile
1
2
3
4
5
6
7
8
9
10
11
12
$ rbenv install -list

Available versions:
:
:
2.0.0-p643
2.0.0-p645 ← latest 2.0.0 (as of 2015/08/06)
2.1.0-dev
2.1.0-preview1
2.1.0-preview2
2.1.0-rc1
:

Install Ruby

1
$ rbenv install -v 2.0.0-p645

Reload

1
$ rbenv rehash

Switch to the installed version

1
$ rbenv global 2.0.0-p645

Verify

1
2
$ ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

That’s all.

Author

Kenzo Tanaka

Posted on

2015-08-06

Licensed under