Created
April 29, 2018 11:53
-
-
Save NickNaso/b17aa454000f1809568841c1dd511370 to your computer and use it in GitHub Desktop.
Node.js Installation script for Linux
This file contains hidden or 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/bash | |
| echo "Node Linux Installer by www.github.com/taaem" | |
| echo "Need Root for installing NodeJS" | |
| sudo sh -c 'echo "Got Root!"' | |
| echo "Get Latest Version Number..." | |
| { | |
| wget --output-document=node-updater.html https://nodejs.org/dist/latest/ | |
| ARCH=$(uname -m) | |
| if [ $ARCH = x86_64 ] | |
| then | |
| grep -o '>node-v.*-linux-x64.tar.gz' node-updater.html > node-cache.txt 2>&1 | |
| VER=$(grep -o 'node-v.*-linux-x64.tar.gz' node-cache.txt) | |
| else | |
| grep -o '>node-v.*-linux-x86.tar.gz' node-updater.html > node-cache.txt 2>&1 | |
| VER=$(grep -o 'node-v.*-linux-x86.tar.gz' node-cache.txt) | |
| fi | |
| rm ./node-cache.txt | |
| rm ./node-updater.html | |
| } &> /dev/null | |
| echo "Done" | |
| DIR=$( cd "$( dirname $0 )" && pwd ) | |
| echo "Downloading latest stable Version $VER..." | |
| { | |
| wget https://nodejs.org/dist/latest/$VER -O $DIR/$VER | |
| } &> /dev/null | |
| echo "Done" | |
| echo "Installing..." | |
| cd /usr/local && sudo tar --strip-components 1 -xzf $DIR/$VER | |
| rm $DIR/$VER | |
| echo "Finished installing!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment