Skip to content

Instantly share code, notes, and snippets.

@khanhtc1202
Created June 18, 2018 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khanhtc1202/ef1a256223c804364e692f2d6dff02ca to your computer and use it in GitHub Desktop.
Save khanhtc1202/ef1a256223c804364e692f2d6dff02ca to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# author: khanhtc
#
# script for installing nodejs from source
#
VERSION=$1
OS=$(uname -s | awk '{print tolower($0)}')
ARCH=$(uname -m | sed 's/x86_/x/g')
RSHELL=$(echo $SHELL | sed 's/\/bin\///g')
PKG_NAME=node-${VERSION}-${OS}-${ARCH}.tar.gz
wget "https://nodejs.org/dist/${VERSION}/${PKG_NAME}"
tar -xzf ${PKG_NAME}
sudo mv $(basename ${PKG_NAME} .tar.gz)/ /usr/local/node
echo "export PATH=$PATH:/usr/local/node/bin" >> ~/.${RSHELL}rc
rm -rf ${PKG_NAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment