LoginSignup
23

posted at

updated at

Organization

Ubuntu 20.04 に rbenv で Ruby 環境を整える最小手順

Ubuntu 20.04 に rbenv による Ruby 環境を整える最小手順をまとめてあります。

前提

  • Ubuntu 20.04 インストール直後
    • シェルは Bash
  • インターネット接続環境

※ WSL2 でも大丈夫です。

インストール

rbenv + ライブラリ

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="~/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(~/.rbenv/bin/rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
apt install -y build-essential libssl-dev zlib1g-dev

rbenv でインストール

rbenv install 2.7.1
rbenv global 2.7.1

rbenv の update

rbenv 自体もアップデートする必要があります。ワンライナーでできます。

(cd "$(rbenv root)" ; git pull ; cd "$(rbenv root)"/plugins/ruby-build ; git pull)

あとがき

WLinux からの卒業を検討しております。

参照情報

EoT

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
What you can do with signing up
23