2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Amazon Linuxでrbenv+ruby-buildを使えるようにする方法

Last updated at Posted at 2015-12-02

概要

"users"グループに属するユーザーなら誰でもrbenvを使えるようにする。
公式の説明(https://github.com/rbenv/rbenv) だとユーザーごとに設定が必要になる。
※この手順+αを記載した雑recipe -> https://github.com/maromaro0013/rackapp

必要なパッケージのインストール

sudo yum install -y git gcc openssl-devel readline-devel zlib-devel libcurl-devel

rbenvをgithubからclone

sudo git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv

ユーザーログイン時に実行するスクリプト

rbenv.sh
export RBENV_ROOT="/usr/local/rbenv"
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init --no-rehash -)"

これを"/etc/profile.d/"に置く
※ログイン時には"rehash"はいらないそうです

スクリプトのパーミッションを変更

sudo chmod 0644 /etc/profile.d/rbenv.sh

rbenvの持ち主とパーミッション変更

sudo chown -R root:users /usr/local/rbenv
sudo chmod -R 775 /usr/local/rbenv
sudo mkdir /usr/local/rbenv/versions
sudo chmod -R 775 /usr/local/rbenv/versions
sudo chown -R root:users /usr/local/rbenv/versions

スクリプト実行しておく

. /etc/profile.d/rbenv.sh

pluginsディレクトリ作っておく

sudo mkdir /usr/local/rbenv/plugins
sudo chmod -R 775 /usr/local/rbenv/plugins
sudo chown -R root:users /usr/local/rbenv/plugins

ruby-buildのclone

sudo git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
sudo chown root:users /usr/local/rbenv/plugins/ruby-build
sudo chmod -R 775 /usr/local/rbenv/plugins/ruby-build
2
3
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
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?