RVM Setup for Ruby and Ruby on Rails

Ruby Version Manager (RVM)

RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. 

RVM Setup for Ruby and Ruby on Rails

sudo apt-get update

sudo apt install gnupg2

gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

or

gpg --keyserver keyserver.ubuntu.com --recv 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

or

command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -

command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -

cd /tmp

curl -sSL https://get.rvm.io -o rvm.sh

less /tmp/rvm.sh

cat /tmp/rvm.sh | bash -s stable --rails

source /home/deployer/.rvm/scripts/rvm

rvm list known

rvm install 2.6.3

rvm list

rvm use 2.6.3 

Rvm Issue: 

Can't install ruby via rvm, Error running '__rvm_make -j4' on ubuntu 22.04

--> rvm pkg install openssl

--> rvm reinstall 2.7.6 --with-openssl-dir=/home/$(whoami)/.rvm/usr


rbenv install

1. sudo apt update


2. sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev


3. curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash


4. echo 'eval "$(rbenv init -)"' >> ~/.bashrc


or 


1. Run `~/.rbenv/bin/rbenv init' to view instructions on how to configure rbenv for your shell.

2. Launch a new terminal window after editing shell configuration files.

3. (Optional) Run the doctor command to verify the installation:

   wget -q "https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-doctor" -O- | bash



5. source ~/.bashrc

6. type rbenv


rbenv install -l


rbenv install 3.2.0  --verbose


rbenv global 3.2.0


ruby -v