Ruby installation on WSL2 + Ubuntu 20.04

Personal notes

Installation of required libraries

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline-dev zlib1g zlib1g-dev imagemagick git
sudo apt-get install -y nodejs npm
sudo apt-get install -y sqlite3 libsqlite3-dev
sudo apt-get install -y libmariadb-dev
sudo apt-get install -y libmysqlclient-dev

Yarn installation

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn -y

Install Ruby

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo '[ -f "$HOME/.profile" ] && source "$HOME/.profile"' >> ~/.bash_profile
echo '[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"' >> ~/.bash_profile
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
~/.rbenv/bin/rbenv init
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile

Verification

rbenv -v

Install ruby-build

mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/sstephenson/ruby-build.git "$(rbenv root)"/plugins/ruby-build

install ruby

rbenv install -l
rbenv install 2.6.6

Confirmation of installed ruby

rbenv global 2.6.6
ruby -v

Drive mount settings

sudo tee /etc/wsl.conf <<EOF >/dev/null
[automount]
options = "metadata"
EOF

~~echo 'export PATH="(echo "PATH" | sed -r -e '"'"'s;:/mnt/[^:]+;;g'"'"')"' >> ~/.bash_profile~~ ~~source ~/.bash_profile~~

However, if you do the above, the PATH such as VS Code will also be changed. .. ..

Reference

Insecure world writable dir ... warning on WSL Ubuntu console https://www.oiax.jp/books/insecure_world_writable_dir.html

Restart Windows for the settings to take effect

Install bundle

gem install bundle

Recommended Posts

Ruby installation on WSL2 + Ubuntu 20.04
Elmer / Ice installation (Ubuntu on WSL)
Install Ruby on Ubuntu 20.04
ubuntu on wsl part 10
Docker installation on WSL2
Docker on Ubuntu18.04 on WSL2 and VSCode installation instructions
Install Java on WSL Ubuntu 18.04
Ruby on Jets Verification (WSL)
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
Install ruby on Ubuntu 20.04 with rbenv
Ruby on Rails installation method [Mac edition]
[Ruby] Building a Ruby development environment on Ubuntu
Use cljstyle with Spacemacs on Ubuntu on WSL2
Try putting Docker in ubuntu on WSL
tmux on Ubuntu
Try running ScalarDB on WSL Ubuntu (Environment Construction)
Set up an SSH server on WSL2 Ubuntu 20.04
JDBC operation check from xampp installation on Ubuntu
Screen recording on Ubuntu 20.04
Try DisplayLink on Ubuntu 20.04
Reinstall Kubernetes on Ubuntu 19.10
Docker installation on CentOS 6
Use Flutter on Ubuntu
Install pyqt5 on ubuntu
OpenAM installation on VirtualBox
Note: Ubuntu installation location
Zabbix 5 installation on CentOS 8
Ruby on Rails Elementary
Ruby on Rails basics
Setting JAVA_HOME on Ubuntu
Install Autoware on Ubuntu 18.04.5
OpenJDK installation on CentOS 7
Put JetBrains on Ubuntu
Use mkdir on ubuntu
Apache2 on Ubuntu20.04 LTS
Use cpplapack on ubuntu
Ruby On Rails Association
Install Homebrew on Ubuntu 20.04
Run tiscamera on Ubuntu 18.04
Build Zabbix on Ubuntu 20.04
Try running ScalarDB on WSL Ubuntu (Sample application creation)
I built an Ubuntu environment on Windows 10 using WSL2.
What I stumbled upon when installing Ruby on Ubuntu
Install rbenv with apt on ubuntu and put ruby
Using Flutter on Ubuntu (Part 2)
Create SSL certificate on Ubuntu 18.04
Building WebGIS on Ubuntu20.04 LTS
Install OpenJDK7 (JAVA) on ubuntu 14.04
Ruby on rails learning record -2020.10.03
From 0 to Ruby on Rails environment construction [macOS] (From Homebrew installation to Rails installation)
Put Ubuntu 20.04.1 on Raspberry Pi 4
Build VNC Server on Ubuntu 20.04
Install Cybozu Office 10 on Ubuntu 20.4
Extend swap area on Ubuntu 18.04
Install Docker on Ubuntu Server 20.04
Ubuntu on Windows Community Preview
Portfolio creation Ruby on Rails
[Note] Flow from docker installation to JupyterLab startup on ubuntu
Ruby on rails learning record -2020.10.04
[Ruby on Rails] Debug (binding.pry)
Ruby on rails learning record -2020.10.05