LoginSignup
31
24

More than 1 year has passed since last update.

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

Last updated at Posted at 2020-06-13

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

31
24
3

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
31
24