The easiest way to install ruby is by using RVM(ruby version manager).If you use RVM you don’t have to worry about dependencies and libaries install with ruby,RVM will take care of that for you.so lets install ruby,open your terminal and enter the command to update your system source list
sudo apt-get update
Next to install curl if you dont have in your system.
sudo apt-get install curl
Next is to install RVM,remember dont use sudo because this is installing in your home directory
\curl -L https://get.rvm.io | bash -s stable
After it is done installing, load RVM. You may first need to exit out of your shell session and start up a new one.
if any error appears showing rvm command not found after this,Enter these lines to ur .bashrc manually
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Next step is to install ruby,for that enter this command
rvm install ruby
note: if you want to install specific version you can choose install by
rvm list known #this will show you available version,pick version and install by
rvm install ruby-version
Now after installation to show installed versions use the command
To set ruby version for the system use the command
rvm use ruby-version --default
Check Ruby version by typing