sudo apt update && sudo apt install -y ruby-full && ruby --version
gem install rails -v 6.1.5.1
sudo snap install ruby --classic
# Use rvm to install Ruby
# https://rvm.io/
# then in the console use this command
# gem install rails
# Now enjoy using rails