Skip to content

Instantly share code, notes, and snippets.

@LuisdelaVega
Last active April 13, 2016 00:51
Show Gist options
  • Save LuisdelaVega/8a35065382fe6c669296ee2975856f40 to your computer and use it in GitHub Desktop.
Save LuisdelaVega/8a35065382fe6c669296ee2975856f40 to your computer and use it in GitHub Desktop.
Build node on your favorite flavor of linux from source. This way you wont be faced with having to sudo npm install stuff. Just change the value of version to the desired one and execute it. Don't forget to do the visudo part (in the comments)
VERSION="v5.7.0"
USERNAME="$(whoami)"
sudo yum install -y gcc-c++ make
# or: yum groupinstall 'Development Tools'
curl -O http://nodejs.org/dist/latest/node-${VERSION}.tar.gz
tar -xvzf node-${VERSION}.tar.gz
cd node-${VERSION}
./configure --prefix=/opt/node
make
sudo mkdir -p /opt/node
sudo chown -R ${USERNAME} /opt/node
make install
echo "export PATH=/opt/node/bin:$PATH" >> ~/.bashrc
# Now do: sudo visudo
# Edit your Defaults secure_path= by adding /opt/node/bin to the end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment