1. apt-get install ruby-full build-essential
2. apt-get install rubygems
3. gem install rails