Skip to content

Instantly share code, notes, and snippets.

@je3f0o
Last active December 17, 2015 12:03
Show Gist options
  • Save je3f0o/3072e4e8d5e4b35cb3bb to your computer and use it in GitHub Desktop.
Save je3f0o/3072e4e8d5e4b35cb3bb to your computer and use it in GitHub Desktop.
Node version 4.0.0 install for ubuntu linux server.

Usage

$ curl -L http://git.io/v0913 | bash /dev/stdin

#!/bin/bash
# Guard
if [ -f /usr/local/bin/node ]; then
echo 'NodeJS is already installed on this server.'
exit 1
fi
VERSION='v4.0.0'
ARCH="x86"
if [ `arch | grep 64` ]; then
ARCH="x64"
fi
NODE="node-${VERSION}-linux-${ARCH}"
NODE_URL="https://nodejs.org/dist/${VERSION}/${NODE}.tar.gz"
pushd /tmp > /dev/null
# wget is preinstalled on ubuntu system
#wget -c --no-check-certificate ${NODE_URL} || curl -O ${NODE_URL}
wget -c --no-check-certificate ${NODE_URL}
tar xzpf "${NODE}.tar.gz"
cd "${NODE}"
sudo cp -a bin lib share include /usr/local
cd ..
rm -rf ${NODE}*
[ -f /usr/local/bin/node ] && echo 'NodeJS v4.0.0 is successfully installed on this server.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment