Install Ruby on Ubuntu

# update packages
sudo apt-get update
# install curl if not already there
sudo apt-get install curl -y
# install RVM
\curl -L | bash -s stable
# load RVM
source ~/.rvm/scripts/rvm
# install RVM dependencies
rvm requirements

# install ruby
rvm install ruby
# use default ruby version (latest)
rvm use ruby --default
# install rubygems
rvm rubygems current
# install Rails
gem install rails


  • the setup seems to be user specific


  • rvm requirements needs to be run as root. may require a password. sudo rvm rquiremenst for some unknown reason does not seem to work.

more on rvm requirements issue

  • the error happens when there are broken sources in /etc/apt/sources.list or /etc/apt/sources.list.d/*.list x
  • the broken source list is because “Ubuntu 12.10 is not supported any more since May 2014. You either need to update to a more recent version of Ubuntu (i.e. 14.04), or find an alternative repository.” x
  • solution sudo apt-get update && sudo apt-get install update-manager-core && sudo do-release-upgrade x
  • the problem with the solution: Ubuntu can only be updated to the next version. Direct upgrades to the latest version only works LTS to LTS. In my case, the server is still on 12.10 (12.04 was LTS, the latest at the moment is 14.04 has already arrived) the best strategy at this point is to take backups and restore on a fresh install of latest version.