for capistrano demo, the following will install a modern ruby env. I just had to do this for the new db server we set up. rbenv is preferable because ruby gets patched a lot for vulnerabilities, but this will work.
sudo apt-get install build-essential -y
sudo apt-get install libxslt-dev libxml2-dev
sudo apt-get install ruby1.9.1-full -y
sudo update-alternatives --config ruby
gem install nokogiri --pre