So, to do this faster,
sudo yum update
sudo yum install openssl openssl-devel
sudo yum groupinstall "Development Tools"
That gets a few things ready on the system, and yum is quick.
Next, I'm using Node Version Manager, or NVM for short. This is just a glorified bash script, though I use it on my dev machine. It's really great. (Especially if your last contract was still using Node 0.10 but pet projects want to use the latest stable version). Also, it avoids all the source code building, which is the main point of this blog post : )
From the readme (all one line):
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
And that's it! I exited my ssh session, and came back. Then quickly ran
nvm install 5.9.1
Which worked flawlessly, and I could run node and npm in my terminal.
$ node -vI personally found that quicker than the other blogs out there. Hopefully it saves you some time as well.
v5.9.1
$ npm -v
3.7.3
Later Edit: When running after this install, I had an issue where my installed user could find Node (like above) but other users could not. The option I went with was from this blog, running the command:
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/localAnd to quote the blog:
The above command is a bit complicated, but all it's doing is copying whatever version of node you have active via nvm into the /usr/local/ directory (where user installed global files should live on a linux VPS) and setting the permissions so that all users can access them.
This command would need to be run each time I ran a version. I also had to make sure /usr/local was in the $PATH of the users that needed Node. And alternative to these extra commands would be to just use the nvm-global version of nvm (a different repo), which I might try next time. But for now, I'm set up so will get back to it!
No comments:
Post a Comment