Note the following is done is Bash shell.

# Install Curl
sudo apt-get -y install curl

# Install RVM, Ruby, and Rails at once. This will take about 40 mins
\curl -sSL https://get.rvm.io | bash -s stable --rails

# Install Node.js
sudo apt-get -y install nodejs