Ubuntu 14.04にrbenvでRubyをインストールする
まずはrbenvをインストールします。
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc source ~/.bashrc rbenv --version
続いてruby-buildをインストールします。
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
引き続きRubyをインストール。
rbenv install -l rbenv install 2.1.3 rbenv global 2.1.3 rbenv rehash
すると、ビルドエラーが出てしまいました。。
Downloading ruby-2.1.3.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/0818beb7b10ce9a058cd21d85cfe1dcd233e98b7342d32e9a5d4bebe98347f01 Installing ruby-2.1.3... BUILD FAILED (Ubuntu 14.04 using ruby-build 20140926-6-gc2b2e15) Inspect or clean up the working tree at /tmp/ruby-build.20141022224750.5954 Results logged to /tmp/ruby-build.20141022224750.5954.log Last 10 log lines: rake 10.1.0 rdoc 4.1.0 test-unit 2.1.3.0 installing rdoc: /home/kta/.rbenv/versions/2.1.3/share/ri/2.1.0/system installing capi-docs: /home/kta/.rbenv/versions/2.1.3/share/doc/ruby The Ruby openssl extension was not compiled. Missing the OpenSSL lib? Configure options used: --prefix=/home/kta/.rbenv/versions/2.1.3 LDFLAGS=-L/home/kta/.rbenv/versions/2.1.3/lib CPPFLAGS=-I/home/kta/.rbenv/versions/2.1.3/include
OpenSSLのライブラリが無い、と怒られているみたいです。
なので、入れてみます。
sudo apt-get install libssl-dev
もう一度ビルドにチャレンジ。今度はうまくいきました。
rbenv install 2.1.3 rbenv global 2.1.3 rbenv rehash