First you'll need to make sure your system has a c++ compiler. For OSX, XCode will work, for Ubuntu, the build-essential package works. You'll also need `git` if you want to track HEAD.
The first line loads the nvm function into your bash shell so that it's available as a command. The second line sets your default node version to the latest released version.