Skip to content

Instantly share code, notes, and snippets.

@bma73
Last active January 30, 2018 14:45
Show Gist options
  • Select an option

  • Save bma73/2e8a6625c3b3419eca1c to your computer and use it in GitHub Desktop.

Select an option

Save bma73/2e8a6625c3b3419eca1c to your computer and use it in GitHub Desktop.
Download and install NodeJS Package (Ubuntu)
#!/bin/bash
FILE=/tmp/nodejs.download
TARGET=/etc/nodejs/
LINK_NODE=/usr/bin/node
LINK_NPM=/usr/bin/npm
echo "Downloading $1"
sudo wget $1 -O $FILE
sudo tar xfm $FILE -C $TARGET
FOLDER=$(ls -t $TARGET | head -1)
sudo rm $LINK_NODE
sudo rm $LINK_NPM
sudo ln /etc/nodejs/$FOLDER/bin/node $LINK_NODE
sudo ln -s /etc/nodejs/$FOLDER/bin/npm $LINK_NPM
node --version
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment