In the past, you used to have to look up a list of required packages to be able to build Ruby correctly. Without some of these packages, Ruby would build but you'd find out later you were missing something like OpenSSL and SSL won't work on your Rails applications. This is another area that's very neatly covered by RVM though, as they've built a database of distributions and what packages are required. Assuming you want to install the latest version of the official Ruby installation (called MRI, or in RVM-speak simply "ruby"), the command is as follows. If it asks for a password, sudo needs your password so apt-get can install the prerequisite packages.
$ rvm install ruby