May 31

Ubuntu 12.10 Rails/Node VirtualBox Install

Git + Heroku + Node.js + PostgreSQL + Rails + Ruby + VirtualBox

This post is more a personal memoir than a tutorial designed for public consumption, but this worked for me installing and configuring an Ubuntu 12.10 virtual machine from scratch on VirtualBox (which is my weapon of choice for VMs). The purpose is to develop Rails and Node.js applications managed through GitHub and deployed to Heroku.


Ruby on Rails


Create a new VirtualBox environment. Important recommended settings:

  • Debian 64bit
  • 2GB+ of RAM
  • VDI (Virtual Disk Image hard-disk type)
  • Fixed size
  • 30+GB storage


Download latest Ubuntu .iso (12.10) and run through the installer (no gotchas)

VirtualBox will automatically ask for media on boot. Mount the ubuntu iso using some virtual drive (PowerISO). Be sure to install guest additions.



Need Ruby for Heroku. Great installation post and usage screencast from the RVM site.

$ sudo apt-get install curl   # Required
$ curl -L | bash -s stable   # Get RVM
$ source ~/.bashrc   # Reboot the shell
$ rvm requirements   # To get the command below
$ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion  # Install Libraries
$ rvm install 1.9.3   # Install ruby v1.9.3
$ rvm use 1.9.3
$ gem install rails   # Install rails (I had to run this command twice. Error trying to find railties the first time.. weird)



Need Git for Heroku as well.

$ sudo apt-get install git-core



Database of choice because Heroku uses it.
Decent post –

$ sudo apt-get install postgresql-9.1
$ sudo -u postgres createuser --superuser $USER
$ sudo -u postgres psql

Replace the $USER below with username and $DATABASE with database name

postgres=# \password $USER
postgres=# \q
$ createdb $DATABASE
$ psql $DATABASE   # To test

Excellent cheat sheet for psql commands –



Install Node.js and npm

$ sudo apt-get install nodejs
$ curl | sudo sh



Tying it all together.

$ gem install heroku
$ heroku login
$ heroku keys:add


Useful Bash_Aliases

# For Node.js
alias hb='heroku pgbackups:capture --expire'
alias hbget='heroku pgbackups:url' # remember to add the .dump file (e.g. hbget b001)
alias hl='heroku logs --tail'
# For git
alias gp='git push'
alias ga='git add'
alias gaa='git add .'
alias gp='git push'
alias gpp='git push production'
alias gl='git log'
alias gs='git status'
alias gd='git diff'
alias gc='git commit -m'
alias gca='git commit -am'
alias gb='git branch'
alias gco='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gpu='git pull'
alias gcl='git clone'


  • Why node.js? I like the rest of your stack, but what are you doing that requires node.js/that node makes easy?

    To me, node.js is where crazy-land begins (see Why on earth would you write a server in Javascript?

    • I was attracted to it because it would require me to only know one language. In the small business application development world, where computational efficiency and scale-ability aren’t important but economic solutions are, that’s a money concept. I’ve never used Node.js for a production project, and that’s purely because it isn’t vetted from a security standpoint.

      I played around with it for one of my personal projects ( viewership statistics collection engine). It’s so cool to pass entire pieces of the application to the browser! I had a hard time breaking my server vs client code mentality.

  • Thanks! Helped me a lot. Everything works as described.
    I didn’t install the node.js though.

  • Is there a difference between the recommended settings for Ubuntu and Debian in virtual box? I’ve always found the virtual box is reeeeally slow. I like vmware player better.

    • I can’t think of a reason for a difference between Ubuntu and generic Debian… VirtualBox definitely requires you to set aside a large amount of your hardware assets to make the guest OS run well, and if you don’t have an SSD, it can take a while to boot. But I’ve never had any issues with it, and I like the simplicity of design.

      VMWare a) costs $$ and b) has a really funky CPU virtualization implementation that I don’t really understand… And I don’t trust things I don’t understand. Like women.

      Here are the difference for those wondering —

      • Cool! Thanks for the link!
        Also vmware actually released Vmware Player for free, it’s not a robust as workstation/fusion but it’s fast.

Leave a comment

WTF is this?

This is my little space in which to play. I ramble about what it's like to...
· Run a 3:57 Mile | 3:39 1500m.
· Build sweet websites.
· Live in Wellington, NZ
  Charlottesville, VA
  Santa Cruz, CA
  Boulder, CO.
· be convicted of grammar crimes.
If you're intrigued...
This is what to expect.