19
21

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 1 year has passed since last update.

rbenvでRubyをインストール

Last updated at Posted at 2015-09-07

###参考サイト

###依存ライブリをインストール

  • yum
sudo yum -y install gcc make openssl openssl-devel gcc-c++ mysql-devel readline-devel libxml2-devel libxslt-devel bzip2
  • apt-get
sudo apt-get install -y libreadline-dev git build-essential libssl-dev zlib1g-dev libyaml-dev libffi-dev zlib1g-dev

##全ユーザーで共通のrbenvを利用

###rubyグループを作成

sudo groupadd ruby
sudo usermod -aG ruby myuser
sudo groups myuser

###rbenvをインストール

cd /usr/local
git clone https://github.com/sstephenson/rbenv.git rbenv
mkdir rbenv/shims rbenv/versions rbenv/plugins

cd rbenv/plugins
git clone https://github.com/sstephenson/ruby-build.git ruby-build
cd ruby-build
./install.sh

cd /usr/local

chgrp -R ruby rbenv
chmod -R g+rwxX rbenv

echo 'export RBENV_ROOT="/usr/local/rbenv"'     >> /etc/profile.d/rbenv.sh
echo 'export PATH="/usr/local/rbenv/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo 'eval "$(rbenv init -)"'                   >> /etc/profile.d/rbenv.sh

source /etc/profile.d/rbenv.sh

echo $PATH

###rubyをインストール

rbenv install --list-all

rbenv install -v 3.2.2

rbenv versions

rbenv global 3.2.2

rbenv rehash

rbenv versions

ruby -v

###折角なのでgemをアップデート

gem update
gem install bundler

##ユーザー別のインストールする場合

###rbenvをインストール

cd ~
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

exec $SHELL -l

###確認

rbenv -v
19
21
2

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
19
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?