Last active
December 27, 2015 18:19
-
-
Save thomseddon/7368814 to your computer and use it in GitHub Desktop.
Install node.js on 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 | |
# Get the latest version no. | |
version=$(wget --quiet --output-document - \ | |
http://nodejs.org/dist/latest/SHASUMS.txt | | |
head --lines 1 | | |
cut --fields 3 --delimiter " " | | |
cut --fields 2 --delimiter "-") | |
name=node-$version-linux-x64 | |
# Retrieve | |
echo Retrieveing $name.tar.gz | |
wget --output-document /tmp/$name.tar.gz \ | |
http://nodejs.org/dist/$version/$name.tar.gz | |
# Inflate | |
tar --gzip --extract --file /tmp/$name.tar.gz --directory /tmp | |
# Install | |
echo Installing | |
cp --recursive --force /tmp/$name/bin/node /usr/bin/node | |
cp --recursive --force /tmp/$name/lib/node_modules /usr/lib/ | |
ln --symbolic ../lib/node_modules/npm/bin/npm-cli.js /usr/bin/npm | |
# Cleanup | |
rm --recursive --force /tmp/node-v*-linux-x64* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment