As root execute:
apt-get update
apt-get install build-essential ruby rails rubygems1.8
apt-get install ruby1.8-dev libopenssl-ruby
Chance PATH at /etc/environment:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/var/lib/gems/1.8/bin"
Update your current environment:
source /etc/environment
Install the Heroku gem:
sudo gem install heroku
Run Heroku authentication configuration:
heroku auth:login
Enter the credentials for your Heroku account.
Done!