Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.