Created
June 18, 2018 17:09
-
-
Save khanhtc1202/ef1a256223c804364e692f2d6dff02ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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