I had searched a lot to install RVM & manage ruby version on ubuntu. First I ignored RVM and tried installing ruby from other sources. But, later it was really difficult to manage the ruby version properly. So, I just figured out the right way, removed all the installed ruby versions and installed via RVM.
Actually its pretty easy to install rvm on ubuntu, you just need to fire a couple of commands.
curl -L https://get.rvm.io | bash
This will install rvm on the system and gives a message RVM installed at ‘/usr/local/rvm/’. Please not the installation path may differ, and we need the path to export RVM paths in the next command
Above command will export rvm paths and we can use
rvmcommands after that. Make sure you are using the RVM installation path for exporting.
Try some RVM commands like
rvm listto make sure rvm is available.
Once RVM is installed, execute the following command to install ruby,
rvm install ruby-2.1.0
Installation would take few moments, and you can install whichever version you need by just changing the version number in the command.
After the installation, just execute
rvm list in terminal to list the installed ruby versions and you can choose one of the available version by executing,
rvm use ruby-2.1.0
rvm accessible from everywhere, please include the following script in your
[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/.rvm/scripts/rvm"
Be sure, to update the command with your rvm installation path.