How to upgrade nodejs on your no.de smartmachine
So you have a brand new Joyent no.de smartmachine, with a really old version of nodejs? Here’s how to upgrade it to a newer version of nodejs.
Upgrade packages
Ensure that you have the latest compiler, etc.
pkgin update
pkgin upgrade
Build nodejs
Refer to https://github.com/joyent/node/wiki/Installation for the details. Here’s how I compiled it on my smartmachine:
ssh node@yourmachine.no.de
git clone --depth 1 git://github.com/joyent/node.git
cd node
Select a version - v0.6.7 was the latest at the time of writing:
VERSION=v0.6.7
git checkout $VERSION
Compile and install to ~/local/…
./configure --prefix=~/local/$VERSION
make
make install
Change the nodejs symlink
Your smartmachine has a symlink that points to the current node installation. This is the version that is used when you ssh in. Derived from: http://wiki.joyent.com/display/node/Setting+the+Node.js+Version
cd ~/local
mv --no-target-directory nodejs nodejs-old
ln -s $VERSION nodejs
hash -r
Change the node service symlink
Run this command as root.
ssh root@yourmachine.no.de
cd /opt/nodejs
VERSION=v0.6.7 # Yes, substitute this with your version again
ln -s ~node/local/$VERSION $VERSION
Version check
ssh node@yourmachine.no.de
node -v
npm -v
Revert if something blew up
cd ~/local
mv --no-target-directory nodejs-old nodejs
Otherwise!
You’re done