ruby:rbenv_systemwide
CentOS6でrbenvをsystem wideにインストール
インストール
- 以下、rootで実行
- rbenvインストール
# cd /usr/local/ # git clone https://github.com/sstephenson/rbenv.git Initialized empty Git repository in /usr/local/rbenv/.git/ remote: Counting objects: 2057, done. remote: Total 2057 (delta 0), reused 0 (delta 0), pack-reused 2057 Receiving objects: 100% (2057/2057), 344.17 KiB | 239 KiB/s, done. Resolving deltas: 100% (1272/1272), done. # mkdir rbenv/shims rbenv/versions # groupadd rbenv # chgrp -R rbenv rbenv # chmod -R g+rwxXs rbenv # git clone git://github.com/sstephenson/ruby-build.git ruby-build Initialized empty Git repository in /usr/local/ruby-build/.git/ remote: Counting objects: 4548, done. remote: Compressing objects: 100% (12/12), done. remote: Total 4548 (delta 6), reused 0 (delta 0), pack-reused 4536 Receiving objects: 100% (4548/4548), 864.59 KiB | 683 KiB/s, done. Resolving deltas: 100% (2354/2354), done. # cd ruby-build # ./install.sh # vi /etc/profile.d/rbenv.sh export RBENV_ROOT="/usr/local/rbenv" export PATH="/usr/local/rbenv/bin:$PATH" eval "$(rbenv init -)" # source /etc/profile.d/rbenv.sh # which rbenv /usr/local/rbenv/bin/rbenv
- インストール可能なrubyのバージョンを確認
# rbenv install --list ... 2.2.0 2.2.1 2.2.2 2.3.0-dev ...
- 2.2.2をインストール
# rbenv install 2.2.2 ... Installed ruby-2.2.2 to /usr/local/rbenv/versions/2.2.2 # rbenv global 2.2.2 # ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
- RubyGemsの確認
# gem -v 2.4.5
- bundlerをインストール
# gem install bundler --no-rdoc --no-ri Fetching: bundler-1.9.9.gem (100%) Successfully installed bundler-1.9.9 1 gem installed
- jenkinsユーザで確認
- シェルのないユーザ(jenkins)でログイン
# su - jenkins --shell=/bin/bash
- rubyの確認
-bash-4.1$ ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
- ログオフ
-bash-4.1$ exit logout
Tips
インストール時にエラーになったら
# rbenv install 2.2.2 Downloading ruby-2.2.2.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/5ffc0f317e429e6b29d4a98ac521c3ce65481bfd22a8cf845fa02a7b113d9b44 Installing ruby-2.2.2... BUILD FAILED (CentOS 6.6 using ruby-build 20150519) Inspect or clean up the working tree at /tmp/ruby-build.20150528100419.2639 Results logged to /tmp/ruby-build.20150528100419.2639.log Last 10 log lines: rake 10.4.2 rdoc 4.2.0 skip installing bundle gems because of lacking zlib installing rdoc: /usr/local/rbenv/versions/2.2.2/share/ri/2.2.0/system installing capi-docs: /usr/local/rbenv/versions/2.2.2/share/doc/ruby The Ruby openssl extension was not compiled. Missing the OpenSSL lib? Configure options used: --prefix=/usr/local/rbenv/versions/2.2.2 LDFLAGS=-L/usr/local/rbenv/versions/2.2.2/lib CPPFLAGS=-I/usr/local/rbenv/versions/2.2.2/include
openssl-develをインストールする
yum -y install openssl-devel
ruby/rbenv_systemwide.txt · 最終更新: 2016/04/06 02:36 by clownclown