Install Ruby on Ubuntu 20.04

Install Ruby on Ubuntu 20.04

flow

--Installation of related applications --Install rbenv (version manager) --Install the specified version with rbenv --Check operation with irb

Installation of related applications

--Execute the following command

$ sudo apt-get install -y libreadline-dev

Install rbenv (version manager)

--Execute the following command

$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv

--Add the following to bashrc or zshrc and put it in your PATH.

export PATH=$PATH:$HOME/.rbenv/bin 

--Confirm that rbenv was installed

#Reload for bash
$ source ~/.bashrc
#Reload for zsh
$ source ~/.zshrc

#Initialization
$ rbenv init
#Version confirmation
$ rbenv --version

Install the specified version with rbenv

--Execute the following command

$ rbenv install 2.7.1
$ rbenv global 2.7.1
$ ruby --version

Operation check with irb

--Finally, check if ruby works in the interactive environment.

$ irb
irb(main)> 5 + 10
=> 15

trouble shooting

rbenv: no such command install when trying to install the specified version with rbenv

Cause

The ruby build plugin is not installed

Correspondence

Execute the following command.

$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

Recommended Posts

Install Ruby on Ubuntu 20.04
Install ruby on Ubuntu 20.04 with rbenv
Install pyqt5 on ubuntu
Install Autoware on Ubuntu 18.04.5
Install Homebrew on Ubuntu 20.04
Install Docker on Ubuntu Server 20.04
Install zabbix agent (5.0) on Ubuntu 18.04
Install Arudino IDE on Ubuntu 20
Install Java on WSL Ubuntu 18.04
Ruby installation on WSL2 + Ubuntu 20.04
Install Ubuntu Desktop 20.10 on RaspberryPi4
Install Arduino IDE on Ubuntu 20.04
Install raspi-config on Ubuntu 20.04 (LTS)
Install Ruby 2.7 on RHEL 8 (AppStream)
Install WordPress 5.5 on Ubuntu 20.04 LTS
Install Ruby 2.7 on CentOS 7 (SCL)
Install PlantUML on Intellij on Ubuntu
Install Ubuntu Server 20.04 on Btrfs
Note: Install PostgreSQL 9.5 on Ubuntu 18.04
Install Ruby on Sakura's VPS
Install rbenv with apt on ubuntu and put ruby
Install Ruby on MSYS2 with pacman
Install AWS IoT Greengrass on Ubuntu
[Ruby on Rails] yarn install --check-files
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
Install JDK and JRE on Ubuntu 16.10
Install ngrok on ubuntu16.04 using Vagrant
Install Ruby 2.5 on CentOS 7 using SCL
How to install WildFly on Ubuntu 18.04
Install MQTT broker Mosquitto on Ubuntu 18.04
Install SonarQube on ECS instance on Ubuntu 16.04
tmux on Ubuntu
How to install production Metabase on Ubuntu
I want to install PHP 7.2 on Ubuntu 20.04.
Install Realtek network driver on Ubuntu Note
[Ruby] Building a Ruby development environment on Ubuntu
Screen recording on Ubuntu 20.04
Web Bluetooth on Ubuntu20.04
Install gradle on mac
Install Ruby 3.0.0 with asdf
Install OpenJDK on macOS
Build and install Wireshark Development Release (3.3.1) on Ubuntu
Install Ubuntu Core 18 on Raspberry Pi 2 Model B
Try DisplayLink on Ubuntu 20.04
Reinstall Kubernetes on Ubuntu 19.10
Install Java on Mac
Install Golang on CentOS 8
Use Flutter on Ubuntu
How to install network drivers on standalone Ubuntu
Install Neo4j 4.1.3 on centOS
Install ROS Noetic ubuntu20.04
Install Vertica 10.0 on CentOS 6.10
How to install NVIDIA driver on Ubuntu 18.04 (Note)
Install Ruby / Rails on Mac M1 Big Sur 2021-01
Install Gradle with ubuntu16.04
Install PostgreSQL 12 on Centos8
Install nginx on centOS7
Install lombok on SpringToolSuite4
Ruby on Rails Elementary
Ruby on Rails basics
Install Python 3 on CentOS 7