毎度おんなじことやっているので、手順を残しておきます。
ローカル環境でrbenvのインストールの方法と違い、どのユーザでログインしても、システム上のrbenvが使える状況を作ります。
gitのインストール
$ sudo yum install git
rbenvのインストール
$ git clone git://github.com/sstephenson/rbenv.git /usr/local/src/rbenv
$ sudo echo 'export RBENV_ROOT="/usr/local/src/rbenv"' >> /etc/profile.d/rbenv.sh
$ sudo echo 'export PATH="${RBENV_ROOT}/bin:${PATH}"' >> /etc/profile.d/rbenv.sh
$ sudo echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
$ source /etc/profile.d/rbenv.sh
$ sudo git clone git://github.com/sstephenson/ruby-build.git /usr/local/src/rbenv/plugins/ruby-build
$ sudo yum install bzip2
$ sudo rbenv install 2.4.1
Last 10 log lines:
checking for ruby... false
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/tmp/ruby-build.20170418104359.2588/ruby-2.4.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
今日も怒られてます。
$ sudo yum install gcc
$ sudo rbenv install 2.4.1
Last 10 log lines:
The Ruby openssl extension was not compiled.
The Ruby readline extension was not compiled.
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `yum install -y openssl-devel readline-devel zlib-devel` to fetch missing dependencies.
なんどでも、なんどでも
$ sudo yum insall openssl-devel
Downloading ruby-2.4.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.bz2
Installing ruby-2.4.1...
BUILD FAILED (Red Hat Enterprise Linux Server 7.3 using ruby-build 20170405-2-g3b15693)
Inspect or clean up the working tree at /tmp/ruby-build.20170418105034.16372
Results logged to /tmp/ruby-build.20170418105034.16372.log
Last 10 log lines:
installing rdoc: /usr/local/src/rbenv/versions/2.4.1/share/ri/2.4.0/system
installing capi-docs: /usr/local/src/rbenv/versions/2.4.1/share/doc/ruby
The Ruby readline extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `yum install -y readline-devel` to fetch missing dependencies.
Configure options used:
--prefix=/usr/local/src/rbenv/versions/2.4.1
LDFLAGS=-L/usr/local/src/rbenv/versions/2.4.1/lib
CPPFLAGS=-I/usr/local/src/rbenv/versions/2.4.1/include
もういっちょ!
$ sudo yum install -y readline-devel
$ sudo rbenv install 2.4.1
成功!
bundlerのインストール
# rbenv shell 2.4.1
# rbenv exec gem install bundler
今後、 rbenvでインストールしたrubyのバージョンごとに、上記のbundlerをインストールしておいてあげるとよいです。